VB3 DDE Example Between VB and Windows Program ManagerID: Q76551
|
This article demonstrates how to send dynamic data exchange (DDE)
interface commands to the Microsoft Windows Program Manager from
Microsoft Visual Basic for Windows using DDE.
The interface commands available through DDE with the Windows Program
Manager are as follows:
CreateGroup(GroupName,GroupPath)
ShowGroup(GroupName,ShowCommand)
AddItem(CommandLine,Name,IconPath,IconIndex,XPos,YPos)
DeleteGroup(GroupName)
ExitProgman(bSaveState)
The following program demonstrates how to use four of the five Windows
Program Manager DDE interface commands and the one DDE request:
Object Name Caption
------ -------- -------
TextBox Text1
Button Command1 Make
Button Command2 Delete
Button Command3 Request
(In Visual Basic version 1.0 for Window set the CtlName Property
for the above objects instead of the Name property.)
Sub Command1_Click ()
Text1.LinkTopic = "ProgMan|Progman"
Text1.LinkMode = 2 ' Establish manual link.
Text1.LinkExecute "[CreateGroup(Test Group)]"
' Make a group in Windows Program Manager.
Text1.LinkExecute "[AddItem(c:\vb\vb.exe, Visual Basic)]"
' Add an item to that group.
Text1.LinkExecute "[ShowGroup(Test Group, 7)]"
' Iconize the group and focus to VB application.
On Error Resume Next ' Disconnecting link with Windows Program
Text1.LinkMode = 0 ' Manager causes an error in Windows 3.0.
' This is a known problem with Windows Program Manager.
End Sub
Sub Command2_Click ()
Text1.LinkTopic = "ProgMan|Progman"
Text1.LinkMode = 2 ' Establish manual link.
Text1.LinkExecute "[DeleteGroup(Test Group)]"
' Delete the group and all items within it.
On Error Resume Next ' Disconnecting link with Windows Program
Text1.LinkMode = 0 ' Manager causes an error in Windows 3.0.
' This is a known problem with Windows Program Manager.
End Sub
Sub Command3_Click ()
Text1.LinkTopic = "ProgMan|Progman"
Text1.LinkItem = "PROGMAN"
Text1.LinkMode = 2 ' Establish manual link.
Text1.LinkRequest ' Get a list of the groups.
On Error Resume Next ' Disconnecting link with Windows Program
Text1.LinkMode = 0 ' Manager causes an error in Windows 3.0.
' This is a known problem with Windows Program Manager.
End Sub
DDE and CreateGroup
Additional query words: 2.00 3.00
Keywords : kbcode IAPDDE
Version : 1.00 2.00 3.00
Platform : WINDOWS
Issue type :
Last Reviewed: June 21, 1999