<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[mittels C++ Icon auf Desktop erzeugen]]></title><description><![CDATA[<p>Guten Morgen ich hätte da mal eine Frage und hoffe sehr das mir da jemand weiterhelfen kann.<br />
Es geht ganz einfach gesagt darum mittels C++ ein Icon auf dem Desktop zu erzeugen.<br />
Weis jemand wie das geht oder hat da jemand Erfahrung mit gemacht?</p>
<p>Wäre wirklich sehr dankbar um jeden Tipp und jede Idee</p>
<p>greetz sand13r</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/199687/mittels-c-icon-auf-desktop-erzeugen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 19:37:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/199687.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Dec 2007 07:55:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mittels C++ Icon auf Desktop erzeugen on Thu, 06 Dec 2007 07:55:18 GMT]]></title><description><![CDATA[<p>Guten Morgen ich hätte da mal eine Frage und hoffe sehr das mir da jemand weiterhelfen kann.<br />
Es geht ganz einfach gesagt darum mittels C++ ein Icon auf dem Desktop zu erzeugen.<br />
Weis jemand wie das geht oder hat da jemand Erfahrung mit gemacht?</p>
<p>Wäre wirklich sehr dankbar um jeden Tipp und jede Idee</p>
<p>greetz sand13r</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1415613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1415613</guid><dc:creator><![CDATA[sand13r]]></dc:creator><pubDate>Thu, 06 Dec 2007 07:55:18 GMT</pubDate></item><item><title><![CDATA[Reply to mittels C++ Icon auf Desktop erzeugen on Thu, 06 Dec 2007 08:46:58 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">/*
* Verknüpfung erstellen mit C++
* ---------------------------------------
*
* Written by M4CH!N3
*
* Params:
*	pszPath =		Pfad zum/zur Verknüpften Ordner/Datei
*	pszArguments=	eventuelle Kommandozeilenparameter
*	pszLocation=	Pfad, wo die Verknüpfung gespeichert werden soll
*	pszWorkingDir=	Working Directory -&gt; Aktives Directory, in welchem die Verknüpfung arbeiten soll
*	pszIcon=		Pfad zum Icon / zur Exe mit dem Icon
*	nCmdShow=		Showstate vom Verknüpften Programm/Ordner (SW_SHOWNORMAL; SW_SHOWMAXIMIZED; SW_SHOWMINNOACTIVE)
*
* November 2006
*
*/
#include &lt;shobjidl.h&gt;
#include &lt;shlguid.h&gt;

typedef IShellLink *LPSHELLLINK; 
typedef IPersistFile *LPPERSISTFILE; 

BOOL CreateShortcut( LPCSTR pszPath, LPCSTR pszArguments, LPCSTR pszLocation, LPCSTR pszWorkingDir, LPCSTR pszIcon, int nCmdShow ) 
{ 
  LPSHELLLINK pShellLink; 
  HRESULT hrCoInit;                        
  HRESULT hr;                             

  hrCoInit = CoInitialize( NULL );                
  hr = CoCreateInstance(   CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&amp;pShellLink ); 
  if( SUCCEEDED( hr ) ) 
  { 
    LPPERSISTFILE pPersistFile; 

    if(SUCCEEDED(pShellLink-&gt;QueryInterface(IID_IPersistFile,(void**)&amp;pPersistFile))) 
    { 
      wchar_t wsz[ MAX_PATH ]; 

      hr = pShellLink-&gt;SetPath(pszPath); 

      if( SUCCEEDED( hr ) ) 
        hr = pShellLink-&gt;SetArguments(pszArguments); 

      if( SUCCEEDED( hr ) ) 
        hr = pShellLink-&gt;SetWorkingDirectory(pszWorkingDir ); 

      if (SUCCEEDED(hr)) 
          hr = pShellLink-&gt;SetIconLocation(pszIcon,0); 

      if( SUCCEEDED( hr ) ) 
        hr = pShellLink-&gt;SetShowCmd(nCmdShow ); 

      if( SUCCEEDED( hr ) ) 
      { 
        MultiByteToWideChar( CP_ACP, 0, pszLocation, -1, wsz, MAX_PATH); 
        hr = pPersistFile-&gt;Save( wsz, TRUE ); 
        hr = pPersistFile-&gt;SaveCompleted( wsz ); 
      } 
    } 
    pShellLink-&gt;Release( ); 
  } 
  if( SUCCEEDED( hrCoInit ) ) CoUninitialize(); 

  return SUCCEEDED( hr ); 
}
</code></pre>
<p>So rufst du es dann auf:</p>
<pre><code class="language-cpp">int _tmain(int argc, _TCHAR* argv[])
{
	CString path = _T(&quot;C:\\WINDOWS&quot;);//Pfad wo der Link hinzeigen soll
	CString arg = _T(&quot;&quot;);//Argumente brauchst du nicht
	CString linkPath = _T(&quot;C:\\Dokumente und Einstellungen\\DeinName\\Desktop\\windows.lnk&quot;);//Pfad zu deinem Desktop (Dateiendung:LNK)
	CString workDir = _T(&quot;C:\\&quot;);//egal, irgendwas
	CString icon = _T(&quot;C:\\WINDOWS&quot;);//pfad, wo das icon herbekommen soll(kann auch eine exe-datei oder ico-datei sein

	int show = SW_SHOWNORMAL;//showflag halt

	cout &lt;&lt; &quot;Verknuepfung wird nun erstellt...\n&quot;;

	if( CreateShortcut(path, arg, linkPath, _T(&quot;C:\\&quot;), path, show) )
		cout &lt;&lt; &quot;Verknuepfung wurde erstellt!\n&quot;;
	else
		cout &lt;&lt; &quot;Fehler beim Erstellen!\n&quot;;

	system(&quot;PAUSE&quot;);

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1415640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1415640</guid><dc:creator><![CDATA[Machine]]></dc:creator><pubDate>Thu, 06 Dec 2007 08:46:58 GMT</pubDate></item><item><title><![CDATA[Reply to mittels C++ Icon auf Desktop erzeugen on Thu, 06 Dec 2007 10:06:37 GMT]]></title><description><![CDATA[<p>ich würd den Pfad zum Desktop aus der Registrierung auslesen lassen...<br />
der entsprechende Schlüssel ist unter HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1415697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1415697</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Thu, 06 Dec 2007 10:06:37 GMT</pubDate></item><item><title><![CDATA[Reply to mittels C++ Icon auf Desktop erzeugen on Thu, 06 Dec 2007 10:07:55 GMT]]></title><description><![CDATA[<p>kann er ja machen.. was er für nen pfad an die funktion übergibt ist mir egal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> :xmas1: :xmas2:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1415699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1415699</guid><dc:creator><![CDATA[Machine]]></dc:creator><pubDate>Thu, 06 Dec 2007 10:07:55 GMT</pubDate></item><item><title><![CDATA[Reply to mittels C++ Icon auf Desktop erzeugen on Thu, 06 Dec 2007 10:08:36 GMT]]></title><description><![CDATA[<p>EH SUPER <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>VIELEN VIELEN DANK habs gleich ausprobiert funktioniert wie eine 1^^<br />
super super super <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>THX THX THX</p>
<p>greetz sand13r</p>
<p>PS. Falls jemand auch mal den Code oben ausprobiert. bei mir gingen die Includes nicht i hab se dann durch</p>
<pre><code class="language-cpp">#include &quot;objbase.h&quot;
#include &quot;shlobj.h&quot;
</code></pre>
<p>ersetzt dann gings ^^</p>
<p>DANKE DANKE DANKE nochmal super echt klasse ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1415702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1415702</guid><dc:creator><![CDATA[sand13r]]></dc:creator><pubDate>Thu, 06 Dec 2007 10:08:36 GMT</pubDate></item></channel></rss>