How to create Program Manager groups and icons?

In Message-ID: <swbaker.863.00048...@oakland.edu>, Steve Baker wrote:

Quote
>I saw a post a few months ago asking how to create Program Manager groups and
>icons from within Delphi apps, and I didn't see any replies.  We have the same
>need in some of our programs, so the question still stands.  Anyone know what
>the PM macro name is to create icons, or is there some Windows API stuff we
>can use??

I have attached some code to the end of this reply which might help you
out. The code will work on a form that has access to a DDEClientConv
(which I named ProgManDDE). With ProgManDDE, you will need to set the
servic and topic (I think) properties to point to the Program Manager
executable (progman.exe)

The code gives an example of deleting a group, creating a group,
adding an item to the newly created group, and using ShowGroup
to minimize the new group.

By the way, you can get extra help on this topic from Delphi
Help. Just search on 'PROGMAN.'

Let me know if the code needs further explanation.

Cheers,

Jeff Gray
jg...@vuse.vanderbilt.edu
http://www.vuse.vanderbilt.edu/~jgray

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

  with ProgManDDE do
     begin

       {This will delete the ReportSmith group}      
       ExecuteMacro('[DeleteGroup(ReportSmith)]', True);
       while WaitStat do Application.ProcessMessages;

       {This will create a new group named "MyGroup"}
       ExecuteMacro('[CreateGroup(MyGroup)]', True);
       while WaitStat do Application.ProcessMessages;

       {This will add an item, called MyApp, to MyGroup}
       The_Executable := '[AddItem(' + Net_Drive + ':\myapp.exe, ' +
                         'MyApp)]' + #0;
       ExecuteMacro(@The_Executable[1], True);
       while WaitStat do Application.ProcessMessages;

       {This will minimize the group}
       ExecuteMacro('[ShowGroup(MyGroup, 6)]', True);
       while WaitStat do Application.ProcessMessages;

    end;