size : 1096
uploaded_on : Thu Nov 5 00:00:00 1998
modified_on : Wed Dec 8 14:03:26 1999
title : Program group functions
org_filename : DeleteProgGrps.Txt
author : Peter Haas
authoremail : PeterJHaas@t-online.de
description : How to add/delete program groups/items to/from progman/explorer
keywords : DDE
tested : not tested yet
submitted_by : The CKB Crew
submitted_by_email : ckb@netalive.org
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : plain
file-type : text/plain
category : delphi-misc
__END_OF_HEADER__
> How can I delete program groups of the progman/explorer?
procedure TForm1.Button1Click(Sender: TObject);
var
DdeClientConv : TDdeClientConv;
AGroupName, APrg, ADesc : String;
AShowCmd : Integer;
procedure SendMacro(const AMacro:String);
var
Cmd : array[0..255] of Char;
begin
if not DdeClientConv.ExecuteMacro(StrPCopy(Cmd,AMacro),False) then
raise Exception.CreateFmt('Macro %s failed',[AMacro]);
end;
begin
DdeClientConv:=TDdeClientConv.Create(Self);
try
with DdeClientConv do begin
ConnectMode:=ddeManual;
SetLink('Progman','Progman');
OpenLink;
end;
try
AGroupName :='Test';
AShowCmd :=1;
APrg :='C:\Windows\NotePad.exe';
ADesc :='Notepad';
SendMacro(Format('[CreateGroup(%s)]',[AGroupname]));
SendMacro(Format('[ShowGroup(%s,%d)]',[AGroupname,AShowCmd]));
SendMacro(Format('[AddItem(%s,%s)]',[APrg,ADesc]));
SendMacro(Format('[DeleteGroup(%s)]',[AGroupname]));
finally
DdeClientConv.CloseLink;
end;
finally
DdeClientConv.Free;
end;
end;