CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    3

    How to call a Dll function ?

    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.



  2. #2
    Join Date
    Apr 1999
    Posts
    15

    Re: How to call a Dll function ?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured