Board index » delphi » Creating Program Group and Icons

Creating Program Group and Icons

  I have looked at the WinAPI reference, but I cannot figure out how to create
a program group, and then populate it with icons.

Any help would be appreciated.

Jeff

 

Re:Creating Program Group and Icons


Quote
Jeff Diamond wrote:

>   I have looked at the WinAPI reference, but I cannot figure out how to create
> a program group, and then populate it with icons.

> Any help would be appreciated.

> Jeff

I think you should check out Steve TeixEira & Xavier Pacheco's book
"Delphi Developers Guide". The book is realy good, and there is an
example in the book that shows how to create a program manager group.

Terje

Re:Creating Program Group and Icons


Quote
j...@quick.net (Jeff Diamond) wrote:
>  I have looked at the WinAPI reference, but I cannot figure out how to create
>a program group, and then populate it with icons.

This is pulled from a quick setup program that I wrote...it
demonstrates both:

procedure  ...
var
   Name, Macro, NewPgm, Desc: string;
   Cmd: array[0..255] of Char;

begin
    {snipped non-necessary code}
     {add the group to program manager}
     Name := 'Your group name here';
     Macro := Format('[CreateGroup(%s)]', [Name]) + #13#10;
     StrPCopy (Cmd, Macro);
     DDEClient.OpenLink;
     if not DDEClient.ExecuteMacro(Cmd, False) then
       if MessageDlg('Unable to create group.',
         mtInformation, mbOkCancel, 0) = mrCancel then
       begin
         DDEClient.CloseLink;   {close link if problem}
         Exit;
       end;

     {now add the program item}
     NewPgm := 'c:\path\you\want\filename.exe';
     Desc := 'My great program';
     Macro := '[AddItem('+NewPgm+', '+Desc+')]' + #13#10;
     StrPCopy(Cmd, Macro);
     if not DDEClient.ExecuteMacro(Cmd, False) then
       if MessageDlg('Unable to create Program Items.',
         mtInformation, mbOkCancel, 0) = mrCancel then
       begin
         DDEClient.CloseLink;  {again, close link if not good}
         Exit;
       end;

     {finally, make sure the group is saved}
     StrCopy(CMD, '[ShowGroup(nonexist,1)]');
     DDEClient.ExecuteMacro(Cmd, False);
     DDEClient.CloseLink;

Hope that this helps you out...you might want to test the error
conditions a little better than I have...

Happy holidays,

Jon

jonl...@atl.mindspring.com

Other Threads