This project: http://www.ozemail.com.au/~markhurd/vbnetdde.zip
(created by Mark Hurd) implements some DDE functionality in a VB.NET
application. Unfortunately, the example project does not implement
any way to send WM_DDE_EXECUTE messages; it only receives them.
The project does, however, contain an example on how to send a
WM_DDE_REQUEST message to another application via DDE:
Private Sub PostRequest(ByVal hWnd As System.IntPtr, ByVal
Item As String)
Dim ItemAtom As Short
Dim FormatID As Short
Try
ItemAtom = GlobalAddAtom(Item)
FormatID =
CShort(System.Windows.Forms.DataFormats.GetFormat( System.Windows.Forms.DataFormats.Text).Id)
DataReceived = False
If PostMessage(hWnd, WM_DDE.REQUEST, Handle,
PackDDElParam(WM_DDE.REQUEST, FormatID, ItemAtom)) = 0 Then
' Clear the Item atom so we don't free it
ItemAtom = 0
End If
Log(" Request sent(" &
hWnd.ToInt32.ToString("x").ToUpper() & ", " & FormatID & "," & Item &
")" & NewLine)
Finally
If ItemAtom <0 Then GlobalDeleteAtom(ItemAtom)
End Try
End Sub
I've tried the obvious things, like changing WM_DDE.REQUEST to
WM_DDE.EXECUTE in the code above, but have only been able to get NACKs
back or get no acknowledgment at all.
Is there anyone out there who can help me figure this one out?
- Don