Author: Jonas Bilinkevicius
Is there a Delphi function or API function with which I can create a program group
for an application?
Answer:
Yes, MkDir or CreateDir. The program "groups" are in fact simple directories under
the users profile directory.
1 uses2 ShlObj;
3 4 procedure FreePidl(pidl: PItemIDList);
5 var6 allocator: IMalloc;
7 begin8 if Succeeded(ShGetMalloc(allocator)) then9 begin10 allocator.Free(pidl);
11 {$IFDEF VER90}12 allocator.Release;
13 {$ENDIF}14 end;
15 end;
16 17 procedure TForm1.Button2Click(Sender: TObject);
18 var19 pidl: PItemIDList;
20 buf: array[0..MAX_PATH] of Char;
21 begin22 if Succeeded(ShGetSpecialFolderLocation(Handle, CSIDL_PROGRAMS, pidl)) then23 begin24 if ShGetPathfromIDList(pidl, buf) then25 ShowMessage(buf); {buf has startmenu\programs folder}26 FreePIDL(pidl);
27 end;
28 end;