Microsoft KB Archive/104943: Difference between revisions
(importing KB archive) |
m (Text replacement - "&" to "&") |
||
(2 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
<div id="TitleRow"> | <div id="TitleRow"> | ||
= <span id="KB104943"></span>VB3 Manipulate Groups & | = <span id="KB104943"></span>VB3 Manipulate Groups & Items in Program Manager Using DDE = | ||
Line 82: | Line 82: | ||
On Error GoTo CGError | On Error GoTo CGError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
cmd = | cmd = "[CreateGroup(" + GGroup.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
CGDone: text1.LinkMode = 0 | CGDone: text1.LinkMode = 0 | ||
Exit Sub | Exit Sub | ||
CGError: | CGError: | ||
MsgBox | MsgBox "Error Adding Group" | ||
Resume CGDone | Resume CGDone | ||
End Sub | End Sub | ||
Line 99: | Line 99: | ||
On Error GoTo DGError | On Error GoTo DGError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
cmd = | cmd = "[DeleteGroup(" + GGroup.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
DGDone: text1.LinkMode = 0 | DGDone: text1.LinkMode = 0 | ||
Exit Sub | Exit Sub | ||
DGError: | DGError: | ||
MsgBox | MsgBox "Error Deleting Group" | ||
Resume DGDone | Resume DGDone | ||
End Sub | End Sub | ||
Line 116: | Line 116: | ||
On Error GoTo SGError | On Error GoTo SGError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
SGDone: | SGDone: | ||
Line 126: | Line 126: | ||
Exit Sub | Exit Sub | ||
SGError: | SGError: | ||
MsgBox | MsgBox "Error Showing Group" | ||
Resume SGDone | Resume SGDone | ||
End Sub | End Sub | ||
Line 136: | Line 136: | ||
On Error GoTo RLError | On Error GoTo RLError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
cmd = | cmd = "[Reload(" + GGroup.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
RLDone: text1.LinkMode = 0 | RLDone: text1.LinkMode = 0 | ||
Exit Sub | Exit Sub | ||
RLError: | RLError: | ||
MsgBox | MsgBox "Error Reloading Group" | ||
Resume RLDone | Resume RLDone | ||
End Sub | End Sub | ||
Line 153: | Line 153: | ||
On Error GoTo AIError | On Error GoTo AIError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
'*** The ShowGroup is necessary because AddItem changes the group | '*** The ShowGroup is necessary because AddItem changes the group | ||
'*** with the focus. ShowGroup forces the group you want the | '*** with the focus. ShowGroup forces the group you want the | ||
'*** action taken to get the focus. | '*** action taken to get the focus. | ||
If (Len(GGroup.Text) | If (Len(GGroup.Text) > 0) Then | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
End If | End If | ||
cmd = | cmd = "[Additem(" + ItemExe.Text + "," + GItem.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
AIDone: | AIDone: | ||
Line 170: | Line 170: | ||
Exit Sub | Exit Sub | ||
AIError: | AIError: | ||
MsgBox | MsgBox "Error adding Item" | ||
Resume AIDone | Resume AIDone | ||
End Sub | End Sub | ||
Line 180: | Line 180: | ||
On Error GoTo DIError | On Error GoTo DIError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
'*** ShowGroup is necessary because DeleteItem changes the group | '*** ShowGroup is necessary because DeleteItem changes the group | ||
'*** with the focus. ShowGroup forces the group you want the action | '*** with the focus. ShowGroup forces the group you want the action | ||
'*** taken to get the focus. | '*** taken to get the focus. | ||
If (Len(GGroup.Text) | If (Len(GGroup.Text) > 0) Then | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
End If | End If | ||
cmd = | cmd = "[DeleteItem(" + GItem.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
DIDone: text1.LinkMode = 0 | DIDone: text1.LinkMode = 0 | ||
Exit Sub | Exit Sub | ||
DIError: | DIError: | ||
MsgBox | MsgBox "Error Deleting Item" | ||
Resume DIDone | Resume DIDone | ||
End Sub | End Sub | ||
Line 206: | Line 206: | ||
On Error GoTo RIError | On Error GoTo RIError | ||
text1.LinkMode = 0 | text1.LinkMode = 0 | ||
text1.LinkTopic = | text1.LinkTopic = "Progman|Progman" | ||
text1.LinkMode = 2 | text1.LinkMode = 2 | ||
'*** ShowGroup forces the group you want the action taken on | '*** ShowGroup forces the group you want the action taken on | ||
'*** to get the focus. | '*** to get the focus. | ||
If (Len(GGroup.Text) | If (Len(GGroup.Text) > 0) Then | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
cmd = | cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
End If | End If | ||
cmd = | cmd = "[ReplaceItem(" + GItem.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
cmd = | cmd = "[Additem(" + ItemExe.Text + "," + GItem.Text + ")]" | ||
text1.LinkExecute cmd | text1.LinkExecute cmd | ||
RIDone: | RIDone: | ||
Line 224: | Line 224: | ||
Exit Sub | Exit Sub | ||
RIError: | RIError: | ||
MsgBox | MsgBox "Error Replacing Item" | ||
Resume RIDone | Resume RIDone | ||
End Sub | End Sub | ||
Line 230: | Line 230: | ||
<li>From the Run menu, choose Start (ALT, R, S) or press the F5 key to run the program. Enter the group you want created in the GGroup textbox and click the Create Group button. You will now see the group you created in Program Manager. To add an item to a group, enter the group in the GGroup textbox. Enter the item you want added in the GItem textbox and enter the command line in the ItemExe textbox. The item will now be in the group you specified.</li></ol> | <li>From the Run menu, choose Start (ALT, R, S) or press the F5 key to run the program. Enter the group you want created in the GGroup textbox and click the Create Group button. You will now see the group you created in Program Manager. To add an item to a group, enter the group in the GGroup textbox. Enter the item you want added in the GItem textbox and enter the command line in the ItemExe textbox. The item will now be in the group you specified.</li></ol> | ||
For more information, refer to the | For more information, refer to the "Programmers Reference, Volume 1: Overview Microsoft Windows SDK," chapter 17, "Shell Dynamic DataExchange Interface." Also, look in the Windows SDK Help file in the Progman topic. | ||
</div> | </div> |
Latest revision as of 12:24, 21 July 2020
Article ID: 104943
Article Last Modified on 12/9/2003
APPLIES TO
- Microsoft Visual Basic 2.0 Standard Edition
- Microsoft Visual Basic 3.0 Professional Edition
- Microsoft Visual Basic 2.0 Professional Edition
- Microsoft Visual Basic 3.0 Professional Edition
This article was previously published under Q104943
SUMMARY
Program Manager has a DDE command-string interface that allows other applications to create, display, delete, and reload groups; add items to groups; replace items in groups; delete items from groups; and close Program Manager. The following commands perform these actions:
- CreateGroup
- Reload (Windows 3.1 only)
- DeleteGroup
- ShowGroup
- ReplaceItem (Windows 3.1 only)
- DeleteItem (Windows version 3.1 only)
- AddItem
MORE INFORMATION
Perform the following steps to produce an application that manipulates Program Manager using DDE:
- Start Visual Basic or if Visual Basic is already running, choose New Project from the File menu (ALT, F, N). Form1 is created by default.
- Add a Textbox control (Text1) to Form1.
- Add a Label control (Label1) to Form1 and change the caption to Group.
- Add a Textbox control (Text2) to Form1 and change the name to GGroup.
- Add a Label control (Label2) to Form1 and change the caption to Item.
- Add a Textbox control (Text3) to Form1 and change the name to GItem.
- Add a Label control (Label3) to Form1 and change the caption to Command Line.
- Add a Textbox control (Text4) to Form1 and change the name to ItemExe.
- Add a Command Button control (Command1) to Form1 and name it CGroup for create group.
Add the following code to the CGroup_Click event of Form1:
Sub CGroup_Click () Dim cmd As String On Error GoTo CGError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 cmd = "[CreateGroup(" + GGroup.Text + ")]" text1.LinkExecute cmd CGDone: text1.LinkMode = 0 Exit Sub CGError: MsgBox "Error Adding Group" Resume CGDone End Sub
- Add a Command Button control (Command2) to Form1 and name it DGroup for Delete Group.
Add the following code to the DGroup_Click event of Form1:
Sub DGroup_Click () Dim cmd As String On Error GoTo DGError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 cmd = "[DeleteGroup(" + GGroup.Text + ")]" text1.LinkExecute cmd DGDone: text1.LinkMode = 0 Exit Sub DGError: MsgBox "Error Deleting Group" Resume DGDone End Sub
- Add a Command Button control (Command3) to Form1 and name it SGroup for ShowGroup.
Add the following code to the SGroup_Click event of Form1:
Sub SGroup_Click () Dim cmd As String On Error GoTo SGError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" text1.LinkExecute cmd cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" text1.LinkExecute cmd SGDone: text1.LinkMode = 0 Exit Sub SGError: MsgBox "Error Showing Group" Resume SGDone End Sub
- Add a Command Button control (Command4) to Form1 and name it Reload.
Add the following code to the Reload_Click event of Form1:
Sub Reload_Click () Dim cmd As String On Error GoTo RLError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 cmd = "[Reload(" + GGroup.Text + ")]" text1.LinkExecute cmd RLDone: text1.LinkMode = 0 Exit Sub RLError: MsgBox "Error Reloading Group" Resume RLDone End Sub
- Add a Command Button control (Command5) to Form1 and name it AItem for add item.
Add the following code to the AItem_Click event of Form1:
Sub AItem_Click () Dim cmd As String On Error GoTo AIError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 '*** The ShowGroup is necessary because AddItem changes the group '*** with the focus. ShowGroup forces the group you want the '*** action taken to get the focus. If (Len(GGroup.Text) > 0) Then cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" text1.LinkExecute cmd cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" text1.LinkExecute cmd End If cmd = "[Additem(" + ItemExe.Text + "," + GItem.Text + ")]" text1.LinkExecute cmd AIDone: text1.LinkMode = 0 Exit Sub AIError: MsgBox "Error adding Item" Resume AIDone End Sub
- Add a Command Button control (Command6) to Form1 and name it DItem for delete item.
Add the following code to the DItem_Click event of Form1:
Sub DItem_Click () Dim cmd As String On Error GoTo DIError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 '*** ShowGroup is necessary because DeleteItem changes the group '*** with the focus. ShowGroup forces the group you want the action '*** taken to get the focus. If (Len(GGroup.Text) > 0) Then cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" text1.LinkExecute cmd cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" text1.LinkExecute cmd End If cmd = "[DeleteItem(" + GItem.Text + ")]" text1.LinkExecute cmd DIDone: text1.LinkMode = 0 Exit Sub DIError: MsgBox "Error Deleting Item" Resume DIDone End Sub
- Add a Command Button control (Command7) to Form1 and name it RItem for replace item.
Add the following code to the RItem_Click event of Form1:
Sub RItem_Click () Dim cmd As String On Error GoTo RIError text1.LinkMode = 0 text1.LinkTopic = "Progman|Progman" text1.LinkMode = 2 '*** ShowGroup forces the group you want the action taken on '*** to get the focus. If (Len(GGroup.Text) > 0) Then cmd = "[ShowGroup(" + GGroup.Text + ", 2" + ")]" text1.LinkExecute cmd cmd = "[ShowGroup(" + GGroup.Text + ", 1" + ")]" text1.LinkExecute cmd End If cmd = "[ReplaceItem(" + GItem.Text + ")]" text1.LinkExecute cmd cmd = "[Additem(" + ItemExe.Text + "," + GItem.Text + ")]" text1.LinkExecute cmd RIDone: text1.LinkMode = 0 Exit Sub RIError: MsgBox "Error Replacing Item" Resume RIDone End Sub
- From the Run menu, choose Start (ALT, R, S) or press the F5 key to run the program. Enter the group you want created in the GGroup textbox and click the Create Group button. You will now see the group you created in Program Manager. To add an item to a group, enter the group in the GGroup textbox. Enter the item you want added in the GItem textbox and enter the command line in the ItemExe textbox. The item will now be in the group you specified.
For more information, refer to the "Programmers Reference, Volume 1: Overview Microsoft Windows SDK," chapter 17, "Shell Dynamic DataExchange Interface." Also, look in the Windows SDK Help file in the Progman topic.
Additional query words: 1.00 2.00 3.00
Keywords: kbcode KB104943