DDEML in .Net

VBLady

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

Code:
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 Im not entirely sure I did correctly.

Code:
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:
Code:
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 youre 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.
 

Similar threads

N
Replies
0
Views
172
NachoShaw
N
P
Replies
0
Views
194
Phil - rather be golfing
P
V
Replies
0
Views
148
Vaishfacer
V
K
Replies
0
Views
193
Kashif Sattar
K
Back
Top