Board index » delphi » Program Group&Icons in Program Manager

Program Group&Icons in Program Manager

I'm making a small distribution program in Delphi 1.0. I want to create
a program group and icon in Program Manager. I think I have to use DDE
client/server or something like this, but I don't know how. I'd
appreciate any kind of help. Thanks.

 

Re:Program Group&Icons in Program Manager


  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

Ivan Petrov <i...@mbox.digsys.bg> wrote in article
<3501558C.BA2A4...@mbox.digsys.bg>...

Quote
> I'm making a small distribution program in Delphi 1.0. I want to create
> a program group and icon in Program Manager. I think I have to use DDE
> client/server or something like this, but I don't know how. I'd
> appreciate any kind of help. Thanks.

Other Threads