Microsoft KB Archive/102577

{| = Using the ShowGroup Command in Program Manager =
 * width="100%"|

Article ID: Q102577

3.00 3.10 WINDOWS kbprg The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) versions 3.0 and 3.1

SUMMARY
Program Manager has a dynamic data exchange (DDE) command-string interface that allows other applications to manipulate Program Manager's group windows. The ShowGroup command, in particular, can be used to instruct Program Manager to display a specified group window minimized, maximized, or restored. Documentation for ShowGroup and other shell dynamic data exchange interfaces can be found in Chapter 17 of the Windows "Programmer's Reference, Volume 1: Overview".

MORE INFORMATION
The docs give the syntax for the ShowGroup command as

ShowGroup(GroupName, ShowCommand) where GroupName identifies the group Window to be minimized, maximized, or restored, and ShowCommand specifies the action that Program Manager is to perform on the group window. It has reported that ShowGroup may fail if GroupName is a string. Samples on the Microsoft Developer Network (MSDN) CD use items of type HDDEDATA and work more reliably.

In Windows versions 3.x, ShowGroup(GroupName, 1) will not activate the group identified by GroupName as indicated by the docs if the group is already in the restored (that is, normal) position. This may lead to undesirable problems in certain cases.

For example, a setup program is trying to add some new items to a Group called "TEST" with the following commands:

ShowGroup(TEST,1); // Make TEST the currently active group. AddItem(Item1,...); // Add items to the currently active group. AddItem(Item2,...); If the group TEST is already restored but not the active group at the time the ShowGroup command is executed, and if some other group (such as MAIN) is the active group, ShowGroup fails to activate the group TEST. Consequently, all the items added will be added to the group MAIN, not to the group TEST as may be desired. The workaround for this problem is to first either minimize or maximize the group, then call ShowGroup(TEST, 1) to activate and restore the group:

ShowGroup(TEST,2) ; // Minimize the group first so that the next time // ShowGroup is called, the group is activated and // restored. ShowGroup(TEST,1) ; // Show the group as the currently active group and // activate it.

AddItem(Item1, ..) ; //    Adds items to the right group. (TEST) AddItem(Item1, ..) ; //    Adds items to the right group. (TEST) Additional reference words: 3.10 progman KBCategory: kbprg KBSubcategory: UsrExt Keywords : kb16bitonly
 * }