Board index » delphi » Creating Windows Group Icons

Creating Windows Group Icons

I'm writing a custom install for our application.  I was wondering how to
create a Windows 3.1 group icon in the Program Manager, and place items
inside of that group (from inside my delphi 1 app, of course)?  I've search
the Win API a little, and can't seem to find the functions.

Also, how do you create Start menu items from inside a delphi application?

Thanks,
Jesse

 

Re:Creating Windows Group Icons


Jesse,
  Here is an example of some code I have used successfully for
Delphi 1.0.  It also works when the app is run under Win95 (e.g. it will
add items to the start\programs menu through progman).  As far as I know it
should work for D2 under Win95.

First put a DdeClientConv component fron the system pallette on the form
and set it's properties as follows:

ConnectMode             =  ddeAutomatic
DdeService              =  (Progman)
DdeTopic                =  (None)
FormatChars             =  False
Name                    =  DDEClient
ServiceApplication      =
Tag                     =  0

  Then use some code like this:

procedure TForm1.CreateGrp;
var
  Macro: string;
  Cmd: array[0..255] of Char;
begin
  Macro := Format('[CreateGroup(%s)]', ['My Applications]) + #13#10;
  StrPCopy (Cmd, Macro);
  if not DDEClient.ExecuteMacro(Cmd, False) then
    MessageDlg('Unable to create group.', mtInformation, [mbOK], 0)
  else
  begin
    Macro := Format('[AddItem(%s)]', ['C:\DIR1\SUBDIR1\MYAPP.EXE,My App'])
+ #13#10;
    {The string includes the full path of the file you want to create an
item for (C:\DIR1\SUBDIR1\MYAPP.EXE) and the name as you want it to appear
in the group window (My App)}
    StrPCopy (Cmd, Macro);
    if not DDEClient.ExecuteMacro(Cmd, False) then
      MessageDlg('Unable to add group item. (My App)', mtInformation,
[mbOK], 0);
    Macro := Format('[AddItem(%s)]', ['C:\DIR1\SUBDIR1\MYHELP.HLP,My App
Help']) + #13#10;
    StrPCopy (Cmd, Macro);
    if not DDEClient.ExecuteMacro(Cmd, False) then
      MessageDlg('Unable to add group item. (My App Help')', mtInformation,
[mbOK], 0);
  end;
end;

As far as I know you have to make sure the program/file is in the right
directory before you call this code or there will be problems with the icon
and stuff.

Hope this helps!
--

Rodney E Geraghty
GERA-Tech
Ottawa, Canada
gera...@ibm.net

Jesse Castleberry <D...@iThink.net> wrote in article
<6e9a0f$ka...@news10.ispnews.com>...

Quote
> I'm writing a custom install for our application.  I was wondering how to
> create a Windows 3.1 group icon in the Program Manager, and place items
> inside of that group (from inside my delphi 1 app, of course)?  I've
search
> the Win API a little, and can't seem to find the functions.

> Also, how do you create Start menu items from inside a delphi
application?

> Thanks,
> Jesse

Other Threads