Board index » delphi » Adding items to groups in win3.1 ??

Adding items to groups in win3.1 ??

How do I add items to program groups using Delphi 1
and windows 3.1 & WFW3.11 ??

Thanks in advance,

Jonathan.

 

Re:Adding items to groups in win3.1 ??


Quote
J.Gould wrote:

> How do I add items to program groups using Delphi 1
> and windows 3.1 & WFW3.11 ??

> Thanks in advance,

> Jonathan.

The Program-Manager communicates via DDE protocol.

To initialize the dialog see the following C-Code (to be translated):
(hwnd is the app window handle)

-------------

// Var's you need...
// -----------------
ATOM atomApp   = GlobalAddAtom("PROGMAN");
ATOM atomTopic = GlobalAddAtom("PROGMAN");

// Initiate Dialog with ProgMan
SendMessage(-1, WM_DDE_INITIATE, hwnd, MAKELONG(atomApp, atomTopic));

// Process your commands
// ---------------------
// (hCommand is a handle received via GlobalAlloc and contains your command.)

HANDLE hCommand = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, strlen(command)+1);
LPSTR  pCommand = GlobalLock(hCommand);
strcpy(pCommand, "[(CreateGroup(NewGroup)]"); // or "[AddItem(C:\A.TXT, Name_of_A, C:\ICONS\A.ICO)]"
GlobalUnlock(hCommand);
SendMessage(hwndPM, WM_DDE_EXECUTE, hwnd, MAKELONG(0, hCommand));

// Dont forget this...
// -------------------
GlobalDeleteAtom(atomApp);
GlobalDeleteAtom(atomTopic);

The Program-Manager will send you a WM_DDE_ACK message to confirm comunication.
wait for it, before you start doing things on it....
-------------

This is just a skeleton, but should give you a hint how it works in general...

Reinhard :)

Re:Adding items to groups in win3.1 ??


Quote
In article <4t58lp$...@hydraulix.bangor.ac.uk>, iss009@thunder (J.Gould) wrote:

::How do I add items to program groups using Delphi 1
::and windows 3.1 & WFW3.11 ??
::
::Thanks in advance,
::
::Jonathan.
::

look at the example code in the Delphi\demos\DDEdemo directory.
the sample app initiates a DDE conversation with Program Manager
and creates a program group.

Mark Vaughan

Re:Adding items to groups in win3.1 ??


Quote
CloudLab Engineer wrote:

> In article <4t58lp$...@hydraulix.bangor.ac.uk>, iss009@thunder (J.Gould) wrote:
> ::How do I add items to program groups using Delphi 1
> ::and windows 3.1 & WFW3.11 ??
> ::
> ::Thanks in advance,
> ::
> ::Jonathan.
> ::

> look at the example code in the Delphi\demos\DDEdemo directory.
> the sample app initiates a DDE conversation with Program Manager
> and creates a program group.

> Mark Vaughan

To add items the systax for the DDE conversation is in the Windows API
help file, I don't have the exact reference to hand, but try searching
for 'DDE'

Re:Adding items to groups in win3.1 ??


Quote
iss009@thunder (J.Gould) wrote:
>How do I add items to program groups using Delphi 1
>and windows 3.1 & WFW3.11 ??
>Thanks in advance,
>Jonathan.

Search in the "Windows-API Help" for the topic "Shell Dynamic-Data
Exchange Interface Overview"

or try the following source:

**************************************************
procedure ProgrammGruppeErstellen;
var
  Cmd      : array[0..255] of Char;
  DDE      : TDDEClientConv;
  PrgDatei : String;

begin
    {Programmgruppe erstellen}
    DDE := TDDEClientConv.Create(StdForm);
    DDE.SetLink('PROGMAN','');
    DDE.ConnectMode := DDEManual;
    StrPCopy (Cmd, '[CreateGroup(TestTestTest)]'+ #13#10);
    DDE.SetLink('PROGMAN','');
    DDE.OpenLink;
    if not DDE.ExecuteMacro(Cmd, True) then
      MessageDlg('Fehler beim Erstellen der Programmgruppe!',
mtInformation, [mbOK, mbHelp], 0);
    DDE.CloseLink;
    DDE.Free;

    {Programmgruppe aktivieren}
    DDE := TDDEClientConv.Create(StdForm);
    DDE.SetLink('PROGMAN','');
    DDE.ConnectMode := DDEManual;
    StrPCopy (Cmd, '[TestTestTest, 1)]');
    DDE.SetLink('PROGMAN','');
    DDE.OpenLink;
    DDE.ExecuteMacro(Cmd, True);
    DDE.CloseLink;
    DDE.Free;

    {evtl. vorhandenes altes Programmobjekt l?schen}
    DDE := TDDEClientConv.Create(StdForm);
    DDE.SetLink('PROGMAN','');
    DDE.ConnectMode := DDEManual;
    StrPCopy (Cmd, '[ReplaceItem(<<Nix los>> Icon!)]');
    DDE.SetLink('PROGMAN','');
    DDE.OpenLink;
    if not DDE.ExecuteMacro(Cmd, False) then
      MessageDlg('Fehler beim L?schen der Programmdatei!',
mtInformation, [mbOK, mbHelp], 26);
    DDE.CloseLink;
    DDE.Free;

    {neues Programmobjekt erstellen}
    PrgDatei := '[AddItem(DUMMY.EXE, <<Nix los>> Icon!, , , 100, 5, '
+ 'C:\' + ', , 2)]';
    DDE := TDDEClientConv.Create(StdForm);
    DDE.SetLink('PROGMAN','');
    DDE.ConnectMode := DDEManual;
    StrPCopy (Cmd, PrgDatei);
    DDE.SetLink('PROGMAN','');
    DDE.OpenLink;
    if not DDE.ExecuteMacro(Cmd, False) then
      MessageDlg('Fehler beim Erstellen der Programmdatei!',
mtInformation, [mbOK, mbHelp], 0);
    DDE.CloseLink;
    DDE.Free;
end;
********************************************************************

Sorry, some parts are in german language

Have fun
Norbert Froehlich

Other Threads