<?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[Neue Programmgruppe im Startmenü]]></title><description><![CDATA[<p>Hallo,</p>
<p>bekomme Verknüpfungen für Desktop und Startmenü soweit hin. Problem habe ich im Startmenü, wo er mir immer direkt ins Startmenü die Links reinsetzt, aber nicht in eine eigene Programmgruppe:</p>
<p>Aufruf wie folgt:</p>
<pre><code class="language-cpp">AnsiString z2,z3,z4;Boolean o2;
   z3=&quot;c:\autoexec.bat&quot;;                                                        // Dateiname
   z2=&quot;Autoexec Batch&quot;;                                                         // Beschreibung Link
   z4=&quot;Neue_Gruppe&quot;;                                                            // Programmgruppe

   o2=CreateShortCut(CSIDL_STARTMENU,z2+&quot;.lnk&quot;,z3,z2,z4,&quot;&quot;);                    // Link erzeugen
   if(o2==false) { z1=&quot;NOT OK&quot;; }                                               // misslungen

   frm1_5_rtfInfo-&gt;SelAttributes-&gt;Color=clGray;                                 // Textfarbe gr
   frm1_5_rtfInfo-&gt;Lines-&gt;Add(&quot;Link Startm.:\t&quot;+z1+&quot;\t&quot;+z3);                    // Info einsetzen
</code></pre>
<p>Funktion:</p>
<pre><code class="language-cpp">Boolean CreateShortCut(int SpecialFolder,AnsiString file,AnsiString Path,AnsiString Description,AnsiString WorkDir,AnsiString Args)
{IShellLink*   pLink;                                                           //
 IPersistFile* pPersistFile;                                                    //
 LPMALLOC      ShellMalloc;                                                     //
 LPITEMIDLIST  DesktopPidl;                                                     //
 char DesktopDir[MAX_PATH];                                                     //

 if(FAILED(SHGetMalloc(&amp;ShellMalloc))) { return false; }                        // keine Speicheranforderung möglich
 if(FAILED(SHGetSpecialFolderLocation(NULL,SpecialFolder ,&amp;DesktopPidl))) { return false; } // Verzeichnisanforderung fehlgeschlagen

 if(!SHGetPathFromIDList(DesktopPidl, DesktopDir)) {                            // Verzeichnnis in Liste NICHT gefunden
  ShellMalloc-&gt;Free(DesktopPidl);                                               // Speicher löschen
  ShellMalloc-&gt;Release();                                                       // und freigeben
  return false;                                                                 // und ohne Ergebnis zurück
 }                                                                              // ende if(!SHG

 ShellMalloc-&gt;Free(DesktopPidl);                                                // Speicher löschen
 ShellMalloc-&gt;Release();                                                        // und freigeben

 if(SUCCEEDED(CoInitialize(NULL))) {
  if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink, (void **) &amp;pLink))) {
   pLink-&gt;SetPath(Path.c_str());                                                // Pfad zur Verknüpfung vorgeben
   pLink-&gt;SetDescription(Description.c_str());                                  // Beschreibung übergeben
   pLink-&gt;SetWorkingDirectory(WorkDir.c_str());                                 // Arbeitsordner übergeben
   pLink-&gt;SetArguments(Args.c_str());                                           // Argumente übergeben
   pLink-&gt;SetShowCmd(SW_SHOW);                                                  // und Link zeigen

   if (SUCCEEDED (pLink-&gt;QueryInterface(IID_IPersistFile, (void **) &amp;pPersistFile))) {
    WideString strShortCutLocation(DesktopDir);                                 // Pfad für Link
    strShortCutLocation+=&quot;\\&quot;;                                                  // Trenner einsetzen
    strShortCutLocation+=+file.c_str();                                         // Dateiname für Link
    pPersistFile-&gt;Save(strShortCutLocation.c_bstr(), TRUE);                     // und sichern
    pPersistFile-&gt;Release();                                                    // und freigeben
   }                                                                            // ende if(Succeeded(pLink

  pLink-&gt;Release();                                                             // Linkaufruf beenden
  }                                                                             // ende if(Succeeded(CoCreate

 CoUninitialize();                                                              // und Initialisierung fertig
 }                                                                              // ende if(Succeeded(CoInit

 return true;                                                                   // alles ok, zurück
}
</code></pre>
<p>Ich vermute mal, daß ich erst für die CLSID Anforderung vorher (?)<br />
die Gruppe anlegen muss, aber wie bzw. wo? Für jeden Tipp dankbar,<br />
habe schon Google und Forum querbeet durchgeforstet, komme aber nicht<br />
mehr weiter...</p>
<p>Danke und Gruss Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126677/neue-programmgruppe-im-startmenü</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 14:06:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126677.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Nov 2005 12:02:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Neue Programmgruppe im Startmenü on Thu, 17 Nov 2005 12:02:48 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>bekomme Verknüpfungen für Desktop und Startmenü soweit hin. Problem habe ich im Startmenü, wo er mir immer direkt ins Startmenü die Links reinsetzt, aber nicht in eine eigene Programmgruppe:</p>
<p>Aufruf wie folgt:</p>
<pre><code class="language-cpp">AnsiString z2,z3,z4;Boolean o2;
   z3=&quot;c:\autoexec.bat&quot;;                                                        // Dateiname
   z2=&quot;Autoexec Batch&quot;;                                                         // Beschreibung Link
   z4=&quot;Neue_Gruppe&quot;;                                                            // Programmgruppe

   o2=CreateShortCut(CSIDL_STARTMENU,z2+&quot;.lnk&quot;,z3,z2,z4,&quot;&quot;);                    // Link erzeugen
   if(o2==false) { z1=&quot;NOT OK&quot;; }                                               // misslungen

   frm1_5_rtfInfo-&gt;SelAttributes-&gt;Color=clGray;                                 // Textfarbe gr
   frm1_5_rtfInfo-&gt;Lines-&gt;Add(&quot;Link Startm.:\t&quot;+z1+&quot;\t&quot;+z3);                    // Info einsetzen
</code></pre>
<p>Funktion:</p>
<pre><code class="language-cpp">Boolean CreateShortCut(int SpecialFolder,AnsiString file,AnsiString Path,AnsiString Description,AnsiString WorkDir,AnsiString Args)
{IShellLink*   pLink;                                                           //
 IPersistFile* pPersistFile;                                                    //
 LPMALLOC      ShellMalloc;                                                     //
 LPITEMIDLIST  DesktopPidl;                                                     //
 char DesktopDir[MAX_PATH];                                                     //

 if(FAILED(SHGetMalloc(&amp;ShellMalloc))) { return false; }                        // keine Speicheranforderung möglich
 if(FAILED(SHGetSpecialFolderLocation(NULL,SpecialFolder ,&amp;DesktopPidl))) { return false; } // Verzeichnisanforderung fehlgeschlagen

 if(!SHGetPathFromIDList(DesktopPidl, DesktopDir)) {                            // Verzeichnnis in Liste NICHT gefunden
  ShellMalloc-&gt;Free(DesktopPidl);                                               // Speicher löschen
  ShellMalloc-&gt;Release();                                                       // und freigeben
  return false;                                                                 // und ohne Ergebnis zurück
 }                                                                              // ende if(!SHG

 ShellMalloc-&gt;Free(DesktopPidl);                                                // Speicher löschen
 ShellMalloc-&gt;Release();                                                        // und freigeben

 if(SUCCEEDED(CoInitialize(NULL))) {
  if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink, (void **) &amp;pLink))) {
   pLink-&gt;SetPath(Path.c_str());                                                // Pfad zur Verknüpfung vorgeben
   pLink-&gt;SetDescription(Description.c_str());                                  // Beschreibung übergeben
   pLink-&gt;SetWorkingDirectory(WorkDir.c_str());                                 // Arbeitsordner übergeben
   pLink-&gt;SetArguments(Args.c_str());                                           // Argumente übergeben
   pLink-&gt;SetShowCmd(SW_SHOW);                                                  // und Link zeigen

   if (SUCCEEDED (pLink-&gt;QueryInterface(IID_IPersistFile, (void **) &amp;pPersistFile))) {
    WideString strShortCutLocation(DesktopDir);                                 // Pfad für Link
    strShortCutLocation+=&quot;\\&quot;;                                                  // Trenner einsetzen
    strShortCutLocation+=+file.c_str();                                         // Dateiname für Link
    pPersistFile-&gt;Save(strShortCutLocation.c_bstr(), TRUE);                     // und sichern
    pPersistFile-&gt;Release();                                                    // und freigeben
   }                                                                            // ende if(Succeeded(pLink

  pLink-&gt;Release();                                                             // Linkaufruf beenden
  }                                                                             // ende if(Succeeded(CoCreate

 CoUninitialize();                                                              // und Initialisierung fertig
 }                                                                              // ende if(Succeeded(CoInit

 return true;                                                                   // alles ok, zurück
}
</code></pre>
<p>Ich vermute mal, daß ich erst für die CLSID Anforderung vorher (?)<br />
die Gruppe anlegen muss, aber wie bzw. wo? Für jeden Tipp dankbar,<br />
habe schon Google und Forum querbeet durchgeforstet, komme aber nicht<br />
mehr weiter...</p>
<p>Danke und Gruss Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/919964</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/919964</guid><dc:creator><![CDATA[Stefan71242]]></dc:creator><pubDate>Thu, 17 Nov 2005 12:02:48 GMT</pubDate></item><item><title><![CDATA[Reply to Neue Programmgruppe im Startmenü on Thu, 17 Nov 2005 12:30:47 GMT]]></title><description><![CDATA[<p>Die Programmgruppen im Startmenu sind einfache Dateiordner, dementsprechend kannst du im Pfad des Startmenus einfach einen neuen Ordner mit dem gewünschten Namen erstellen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/919985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/919985</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Thu, 17 Nov 2005 12:30:47 GMT</pubDate></item><item><title><![CDATA[Reply to Neue Programmgruppe im Startmenü on Thu, 17 Nov 2005 12:37:18 GMT]]></title><description><![CDATA[<p>Hallo, audacia</p>
<p>Ordner erzeugen, gut. Aber wie übergebe ich dann diesen Pfad anstatt des<br />
Standardparameters CSIDL_STARTMENU ( +z4 ?????) ?</p>
<pre><code class="language-cpp">AnsiString z2,z3,z4;Boolean o2;
   z3=&quot;c:\autoexec.bat&quot;;                                                        // Dateiname
   z2=&quot;Autoexec Batch&quot;;                                                         // Beschreibung Link
   z4=&quot;Neue_Gruppe&quot;;                                                            // Programmgruppe

   o2=CreateShortCut(CSIDL_STARTMENU +z4?????,z2+&quot;.lnk&quot;,z3,z2,&quot;&quot;,&quot;&quot;);           // Link erzeugen
</code></pre>
<p>Gruss Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/919993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/919993</guid><dc:creator><![CDATA[Stefan71242]]></dc:creator><pubDate>Thu, 17 Nov 2005 12:37:18 GMT</pubDate></item><item><title><![CDATA[Reply to Neue Programmgruppe im Startmenü on Thu, 17 Nov 2005 12:59:08 GMT]]></title><description><![CDATA[<p>Du könntest z.B. deiner Funktion einen zusätzlichen Parameter spendieren, der den Namen eines ggf. zu erstellen Unterordners angibt, oder alternativ die Funktion in zwei Funktionen aufteilen (was ich bevorzugen würde):</p>
<pre><code class="language-cpp">AnsiString GetSpecialFolderLocation (int SpecialFolder)
{
  LPMALLOC      ShellMalloc;
  LPITEMIDLIST  DesktopPidl;
  char DesktopDir[MAX_PATH];

  if(FAILED (SHGetMalloc (&amp;ShellMalloc)))
    return (&quot;&quot;);        // keine Speicheranforderung möglich
  if(FAILED(SHGetSpecialFolderLocation (NULL, SpecialFolder, &amp;DesktopPidl)))
    return (&quot;&quot;);        // Verzeichnisanforderung fehlgeschlagen

  if(!SHGetPathFromIDList (DesktopPidl, DesktopDir))
  {                                  // Verzeichnnis in Liste NICHT gefunden
    ShellMalloc-&gt;Free (DesktopPidl); // Speicher löschen
    ShellMalloc-&gt;Release ();         // und freigeben
    return (&quot;&quot;);                     // und ohne Ergebnis zurück
  }

  ShellMalloc-&gt;Free (DesktopPidl); // Speicher löschen
  ShellMalloc-&gt;Release (); // und freigeben
  return (AnsiString (DesktopDir));
}

bool CreateShortCut (AnsiString SavePath, AnsiString Path, AnsiString Description, AnsiString WorkDir, AnsiString Args)
{
  IShellLink*   pLink;
  IPersistFile* pPersistFile;

  if(SUCCEEDED (CoInitialize (NULL)))
  {
    if(SUCCEEDED (CoCreateInstance (CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &amp;pLink)))
    {
      pLink-&gt;SetPath (Path.c_str());                 // Pfad zur Verknüpfung vorgeben
      pLink-&gt;SetDescription (Description.c_str());   // Beschreibung übergeben
      pLink-&gt;SetWorkingDirectory (WorkDir.c_str());  // Arbeitsordner übergeben
      pLink-&gt;SetArguments (Args.c_str());            // Argumente übergeben
      pLink-&gt;SetShowCmd (SW_SHOW);                   // und Link zeigen

      if (SUCCEEDED (pLink-&gt;QueryInterface (IID_IPersistFile, (void **) &amp;pPersistFile)))
      {
        pPersistFile-&gt;Save (WideString (SavePath).c_bstr (), TRUE); // und sichern
        pPersistFile-&gt;Release ();                                // und freigeben
      }

      pLink-&gt;Release (); // Linkaufruf beenden
    }

    CoUninitialize ();   // und Initialisierung fertig
  }
  return (true);
}

...

CreateShortCut (GetSpecialFolderLocation (CSIDL_STARTMENU) + &quot;\\Name des Links.lnk&quot;, &quot;C:\\autoexec.bat&quot;, &quot;AutoExec Batch File&quot;, &quot;C:\\&quot;, &quot;&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/920019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920019</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Thu, 17 Nov 2005 12:59:08 GMT</pubDate></item><item><title><![CDATA[Reply to Neue Programmgruppe im Startmenü on Fri, 18 Nov 2005 11:31:03 GMT]]></title><description><![CDATA[<p>Hallo, audacia</p>
<p>erstmal danke für Deine Antwort. Habe es implementiert und erweitert<br />
und geht. Vielen Dank!</p>
<p>Hier für alle die danach suchen (2 Routinen zum Erzeugen):</p>
<pre><code class="language-cpp">AnsiString GetSpecialFolderLocation (int SpecialFolder)
{LPMALLOC      ShellMalloc;                                                     //
 LPITEMIDLIST  DesktopPidl;                                                     //
 char DesktopDir[MAX_PATH];                                                     //

 if(FAILED(SHGetMalloc (&amp;ShellMalloc))) { return (&quot;&quot;); }                        // keine Speicheranforderung möglich
 if(FAILED(SHGetSpecialFolderLocation (NULL, SpecialFolder, &amp;DesktopPidl))) { return (&quot;&quot;); } // Verzeichnisanforderung fehlgeschlagen, zurück

 if(!SHGetPathFromIDList (DesktopPidl, DesktopDir)) {                           // Verzeichnnis in Liste NICHT gefunden
  ShellMalloc-&gt;Free (DesktopPidl);                                              // Speicher löschen
  ShellMalloc-&gt;Release ();                                                      // und freigeben
  return (&quot;&quot;);                                                                  // und ohne Ergebnis zurück
 }                                                                              // ende if(!SHGet

 ShellMalloc-&gt;Free (DesktopPidl);                                               // Speicher löschen
 ShellMalloc-&gt;Release ();                                                       // und freigeben

 return (AnsiString (DesktopDir));                                              // und Rückgabe Verzeichnisname
}

Boolean CreateShortCut(AnsiString SavePath, AnsiString Path, AnsiString Description, AnsiString WorkDir, AnsiString Args,AnsiString NewGroup)
{AnsiString zLink=SavePath;Boolean o1;                                          // Vars definieren
 if(NewGroup.Length()&gt;0) { zLink=zLink+&quot;\\&quot;+NewGroup; }                         // Neue Programmgruppe mit an Zielordner hängen (Startmenü)

 IShellLink*   pLink;                                                           //
 IPersistFile* pPersistFile;                                                    //

 if(SUCCEEDED (CoInitialize(NULL))) {
  if(SUCCEEDED (CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &amp;pLink))) {
   pLink-&gt;SetPath (Path.c_str());                                               // Pfad zur Verknüpfung vorgeben
   pLink-&gt;SetDescription (Description.c_str());                                 // Beschreibung übergeben
   pLink-&gt;SetWorkingDirectory (WorkDir.c_str());                                // Arbeitsordner übergeben
   pLink-&gt;SetArguments (Args.c_str());                                          // Argumente übergeben
   pLink-&gt;SetShowCmd (SW_SHOW);                                                 // und Link zeigen

   if (SUCCEEDED (pLink-&gt;QueryInterface(IID_IPersistFile,(void **) &amp;pPersistFile))) {
    if(DirectoryExists(zLink)==false) {                                         // ggfs. neue Programmgruppe erstellen
     o1=ForceDirectories(zLink);                                                // neuen Ordner erstellen
     if(o1==false) { zLink=SavePath; }                                          // nicht ok, also Links ohne Gruppe/Ordner eintragen
    }                                                                           // ende if(Dir

    zLink=zLink+&quot;\\&quot;+Description+&quot;.lnk&quot;;                                        // und ergänzen mit Linkname
    pPersistFile-&gt;Save(WideString(zLink).c_bstr(),TRUE);                        // und sichern
    pPersistFile-&gt;Release ();                                                   // und freigeben
   }                                                                            // ende if(SUCC pLink
  pLink-&gt;Release ();                                                            // Linkaufruf beenden
  }                                                                             // ende if(SUCC CoCreate

 CoUninitialize ();                                                             // und Initialisierung fertig
 }                                                                              // ende if(SUCC CoIit

 return (true);                                                                 // alles ok
}
</code></pre>
<p>Aufruf Desktop Link:</p>
<pre><code class="language-cpp">z3=zZiel+DatenPipe(1,2,z4,&quot;!!&quot;);                                             // Dateiname
   z2=DatenPipe(1,3,z4,&quot;!!&quot;); z1=&quot;OK&quot;;                                          // Beschreibung Link

   o2=CreateShortCut(GetSpecialFolderLocation(CSIDL_DESKTOP),z3,z2,&quot;&quot;,&quot;&quot;,&quot;&quot;);
   if(o2==false) { z1=&quot;NOT OK&quot;; }                                               // misslungen
</code></pre>
<p>Aufruf Startmenü (ggfs. mit neuer Gruppe z4):</p>
<pre><code class="language-cpp">z3=zZiel+DatenPipe(1,2,z4,&quot;!!&quot;);                                             // Dateiname
   z2=DatenPipe(1,3,z4,&quot;!!&quot;); z1=&quot;OK&quot;;                                          // Beschreibung Link
   z4=DatenPipe(1,4,z4,&quot;!!&quot;);                                                   // Programmgruppe

   o2=CreateShortCut(GetSpecialFolderLocation(CSIDL_STARTMENU),z3,z2,&quot;&quot;,&quot;&quot;,z4);
   if(o2==false) { z1=&quot;NOT OK&quot;; }                                               // misslungen
</code></pre>
<p>Aufruf Autostart:</p>
<pre><code class="language-cpp">z3=zZiel+DatenPipe(1,2,z4,&quot;!!&quot;);                                             // Dateiname
   z2=DatenPipe(1,3,z4,&quot;!!&quot;); z1=&quot;OK&quot;;                                          // Beschreibung Link

   o2=CreateShortCut(GetSpecialFolderLocation(CSIDL_STARTUP),z3,z2,&quot;&quot;,&quot;&quot;,&quot;&quot;);
   if(o2==false) { z1=&quot;NOT OK&quot;; }                                               // misslungen
</code></pre>
<p>Zur Erklärung: AnsiString zZiel ist der Pfad zur Datei; z3 ergibt dann den Pfd+Dateiname; z2=Beschreibung für den Link (Dateikonform!), o2=Ergebniss,<br />
z4=ggfs. neue Programmgruppe oder Unterordner z.B. auf dem Desktop</p>
<p>Danke für Deine Hilfe. Gruss Stefan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/920413</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/920413</guid><dc:creator><![CDATA[Stefan71242]]></dc:creator><pubDate>Fri, 18 Nov 2005 11:31:03 GMT</pubDate></item></channel></rss>