» Help

Communicate with Windows Program Manager using DDE

   

All the communications with the program manager of Windows has to be done with DDE (Dynamic Data Exchange). If you want to install a program icon to a Windows group you have to know something about DDE and the macro commands you can use.

procedure Form1.ProgManDDE(const MacroLines : TStrings);
  {sends a group of macro's to the program-manager}
begin
  DDEClient.OpenLink; 
  { DDEClient = name of the TDdeClientConv component }
  try 
    if not DDECLient.ExecuteMacroLines(MacroLines, False) then 
      MessageDlg(
        'Could not execute the DDE commands', mtInformation, [mbOk], 0
      );
  finally
    DDEClient.CloseLink;
    Application.BringToFront; 
  end;
end;

procedure Form1.ButStartUpClick(Sender: TObject);
  {button click event handler}
var
  lines: TStringList; 
  str: String;
begin 
  lines := TStringList.Create;
  Lines.Clear;
  { compose the macro commands } 
  str := Application.ExeName;
  Lines.Add('[CreateGroup(test group)]');
  Lines.Add('[AddItem(' + str + ', Reminder 2.0)]'); 
  { excute the macro commands }
  ProgmanDDE(lines);
  lines.free; 
end;
Author: Shlomo Abuisak
Contributor: Shlomo Abuisak
Added: 2009-11-05
Last updated: 2009-11-05

« Return to contents »