Hi Y'all,
can someone help me convert the next few lines of code from c++ to c#?
I've given it a try myself but my program keeps crashing when I use my c# code. I think the difficulty lies in converting the different datatypes. Help is greatly appreciated.
Here's tha code:
BOOL EXAPI
SetCallback(
WORD wPortNumber,
BOOL (CALLBACK* lpfnCallbackProc)(WORD, ULONG, INT, LPCALLBACKDATA, LPVOID),
LPVOID lpParam,
BOOL bDoCoInitialize = FALSE
);
BOOL CALLBACK EXPORT CallbackProc(WORD wPortAddress, ULONG ulIPAddress, INT cCommand, LPCALLBACKDATA lpData, LPVOID lpParam)
{
return TRUE;
}
// Definitions for callback functions
typedef struct tagBLOCKELEMENT {
DWORD dwStructSize; // structure size
LONG nType; // data type (see constants below)
LPVOID lpData; // pointer to data
} BLOCKELEMENT, *PBLOCKELEMENT, FAR *LPBLOCKELEMENT;
typedef struct tagCALLBACKDATA {
DWORD dwStructSize; // structure size
LONG nStartNo; // start number of data block
LONG nNumberOfElements; // number of data elements
LONG nBlockMode; // mode of block operation
LPBLOCKELEMENT lpDataBlock; // pointer to data block
} CALLBACKDATA, *PCALLBACKDATA, FAR *LPCALLBACKDATA;
Thanks in advance everyone.
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).