Click to See Complete Forum and Search --> : callback from C dll
orbits
October 11th, 2001, 04:39 AM
in our app we r interacting with c dll's provided by the third party vendor.
to reference the dll we are using 'public declare'. there is one function in the dll which does a callback to one of our vb procedure. we pass the address of this vb procedure as an argumant to the dll function.
when the callback comes general exception error is raised 'Cannot write to memory'
thanks in advance
Clearcode
October 11th, 2001, 05:44 AM
You need to post the TypeDef, Declare statement and Function that you are passing for us to have any hope of helping you.
HTH,
D.
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
orbits
October 11th, 2001, 06:21 AM
typedef struct _MTDAC_EVENT {
ULONG Status;
DWORD TimeStamp;
ULONG EventCode;
ULONG SubReason;
ULONG Board;
ULONG Channel;
ULONG UserEvent;
PVOID UserData;
} MTDAC_EVENT, *PMTDAC_EVENT;
ULONG MTDACStartLink(MTDAC_EVENT_CALLBACK callback);
The above is as documented by the third party vendor
And following is our VB Declarations
Public Type MTDAC_EVENT
Status As Long
TimeStamp As Long
EventCode As Long
SubReason As Long
Board As Long
Channel As Long
UserEvent As Long
UserData As Long
End Type
Private Declare Sub ExecuteCallback Lib "vcvbnew.dll" (ByVal fnName As Long)
Call ExecuteCallback(AddressOf MyFunction)
Public Sub MyFunction(MTDAC As MTDAC_EVENT)
MsgBox "Channel : " & MTDAC.Channel
MsgBox "Event : " & MTDAC.EventCode
End Sub
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.