Microsoft KB Archive/132308

{| = How to Use DDE from FoxPro to Control Windows Program Manager =
 * width="100%"|

ID: Q132308

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.6 and 2.6a

SUMMARY
This article shows by example how to use dynamic data exchange (DDE) to issue commands to the Microsoft Windows Program Manager from FoxPro for Windows.

The following commands are referenced in this article:


 * CreateGroup(groupname)
 * ShowGroup(groupname, showcommand)
 * Additem(command line,item name,icon path,X position,Y position)
 * DeleteGroup(groupname)

For a full explanation of these commands, please see Chapter 22, pages 19-22 of the "Microsoft Windows Software Development Kit Guide to Programming," version 3.1.

Step-by-Step Example
1. Use the following command to open a DDE channel to the Windows Program

Manager:

iChannel=DDEInitiate("Progman", "Progman") 2. Use the following command to create a new program group named Test Group:

=DDEExecute(iChannel,"[CreateGroup(Test Group)]") 3. Use the following ShowGroup command (,7) to minimize Test Group to an  icon:

=DDEExecute(iChannel,"[ShowGroup(Test Group, 7)]") 4. Use the following ShowGroup command (,1) to expand Test Group, and make it the active group:

=DDEExecute(iChannel,"[ShowGroup(Test Group, 1)]") 5. Use the following command to add an item to Test Group (The Readme.txt  file from the the FoxPro for Windows root directory) with an icon:

=DDEExecute(iChannel,"[AddItem(C:\fpw26\readme.txt,;         FoxPro for Windows ReadMe,;          C:\fpw26\goodies\fox\help.ico,0)]")

NOTE: The AddItem option adds the program item to the active group (see  step 4). 6. Use the following command to delete Test Group: =DDEExecute(iChannel,"[DeleteGroup(Test Group)]") 7. Use the following command to terminate the DDE Channel: =DDETerminate(iChannel)