Mirror

Create a Program Group for an application (Views: 100)


Problem/Question/Abstract:

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.

uses
  ShlObj;

procedure FreePidl(pidl: PItemIDList);
var
  allocator: IMalloc;
begin
  if Succeeded(ShGetMalloc(allocator)) then
  begin
    allocator.Free(pidl);
{$IFDEF VER90}
    allocator.Release;
{$ENDIF}
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  pidl: PItemIDList;
  buf: array[0..MAX_PATH] of Char;
begin
  if Succeeded(ShGetSpecialFolderLocation(Handle, CSIDL_PROGRAMS, pidl)) then
  begin
    if ShGetPathfromIDList(pidl, buf) then
      ShowMessage(buf); {buf has startmenu\programs folder}
    FreePIDL(pidl);
  end;
end;

<< Back to main page