Click to See Complete Forum and Search --> : How to call a Dll function ?


ChrisThal
May 23rd, 1999, 04:17 PM
Hi,

I've great trouble with dll. I would want to crop a DIB (Bitmapinfoheader) by using DIB_BitBlt of dibeng.dll :

BOOL DIB_BitBlt(LPPDEVICE lpDestDev, WORD wDestX, WORD wDestY,
LPPDEVICE lpSrcDev, WORD wSrcX, WORD wSrcY, WORD wXext,
WORD wYext,long Rop3, LPBRUSH lpPBrush, LPDRAWMODE lpDrawMode)

But I couldn't manage to load it, call it and then use it (using LoadLibray or __dllimport)

I've tried :



typedef BOOL (*PExportedFn)(LPPDEVICE, WORD, WORD, LPPDEVICE, WORD, WORD, WORD, WORD, LONG , LPBRUSH , LPDRAWMODE );
PExportedFn pfnEF;
DWORD error ;
HMODULE hMod = LoadLibrary("dibeng.dll");

if (hMod == NULL )
{
error = GetLastError();
if (!deja)
{
ErrMsg("Erreur : %d",error);
deja = TRUE;
}
return hbm;
}

pfnEF = (PExportedFn)GetProcAddress(hMod,"DIB_BitBlt");


pfnEF(hbmNew,0,0,hbm,0,0,50,50,SRCCOPY ,NULL,NULL);





But error = 31 // A device attached to the system is not functioning.

Please, it would be very cool if someone can tell me what's wrong
Do i need to add something ?

If you could send me a piece of source to show me how to proceed because I've tried everything without being successfull.

Thanks by advance, Christophe.

ShengTian Liao
May 25th, 1999, 08:47 AM
First, check is the dll in the right directory.
Second, check whether the function exist in the dll(using dumpbin /exports).
Third, check the call convension.

1st