DDEML in .Net

VBLady

Newcomer
Joined
Nov 13, 2002
Messages
9
Location
Shelton, WA
Has anyone done this? Attempted to use the sdk's API calls in .Net? My DDEInitialize function is failing with DMLERR_INVALIDPARAMETER. Here is the call:

Visual Basic:
Dim iResult As Integer = DdeInitialize(idInst, AddressOf DDECallback, APPCMD_CLIENTONLY, 0)

My guess is it might be the callback function that is the bad parameter. In .Net I had to declare a delegate.. which I'm not entirely sure I did correctly.

Visual Basic:
Delegate Function DDECall(ByVal uType As Long, ByVal uFmt As Long, ByVal hConv As Long, _
                                ByVal hszTopic As Long, ByVal hszItem As Long, ByVal hData As Long, _
                                ByVal dwData1 As Long, ByVal dwData2 As Long) As Long

    Public Function DDECallback(ByVal uType As Long, ByVal uFmt As Long, ByVal hConv As Long, _
                        ByVal hszTopic As Long, ByVal hszItem As Long, ByVal hData As Long, _
                        ByVal dwData1 As Long, ByVal dwData2 As Long) As Long
        DDECallback = 1
    End Function

Then in the function declaration for the DDEInitialize, I used the delegate type for the parameter:
Visual Basic:
Public Declare Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (ByVal pidInst As Long, ByVal pfnCallback As DDECall, ByVal afCmd As Long, ByVal ulRes As Long) As Integer

If anyone has done this before, please chime in.. I would really appreciate it.

Frances
 
DDE is horribly outdated and should be avoided if possible. If you tell us what you're trying to do, we may be able to come up with a better way to do it.


Oh, and by the way, the problem with the delcare is that the Longs need to be Integers in .NET.
 
Back
Top