Hello everyone. I'm new to PB and have a quick question about creating a stdcall wrapper DLL for an existing cdecl DLL.
Ok, so I have a function in a cdecl DLL defined in its documentation as such:
int SN_SetBoardWindow(
HWND hwnd,
BOOL bResize,
int board
);
I create a new PB DLL and declare this function as:
DECLARE FUNCTION SN_SetBoardWindow CDECL LIB "mid2250.dll" ALIAS "SN_SetBoardWindow" (BYVAL hwnd AS DWORD, BYVAL resize AS LONG, BYVAL boardnum AS LONG) AS LONG
I then create a new function in my new DLL:
FUNCTION PT_SetBoardWindow SDECL ALIAS "PT_SetBoardWindow" (BYVAL hwnd AS LONG, BYVAL resize AS LONG, BYVAL boardnum AS LONG) EXPORT AS LONG
FUNCTION = SN_SetBoardWindow(CDWD(hwnd),resize,boardnum)
END FUNCTION
Am I on the right track in using the declare and a new sdecl function? If so, then can someone tell me why this function returns a 'bad dll calling convention' in VB6?
Thanks in advance for any tips/suggestions/help that anyone may give...
Jon
Ok, so I have a function in a cdecl DLL defined in its documentation as such:
int SN_SetBoardWindow(
HWND hwnd,
BOOL bResize,
int board
);
I create a new PB DLL and declare this function as:
DECLARE FUNCTION SN_SetBoardWindow CDECL LIB "mid2250.dll" ALIAS "SN_SetBoardWindow" (BYVAL hwnd AS DWORD, BYVAL resize AS LONG, BYVAL boardnum AS LONG) AS LONG
I then create a new function in my new DLL:
FUNCTION PT_SetBoardWindow SDECL ALIAS "PT_SetBoardWindow" (BYVAL hwnd AS LONG, BYVAL resize AS LONG, BYVAL boardnum AS LONG) EXPORT AS LONG
FUNCTION = SN_SetBoardWindow(CDWD(hwnd),resize,boardnum)
END FUNCTION
Am I on the right track in using the declare and a new sdecl function? If so, then can someone tell me why this function returns a 'bad dll calling convention' in VB6?
Thanks in advance for any tips/suggestions/help that anyone may give...
Jon
Comment