Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

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.

 

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:

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

  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...