首先你要知道所要调用函数的原型格式。然后才能使用。
HINSTANCE hInst = LoadLibrary("User32.dll");
if(hInst)
{
typedef BOOL(* pfn)(void);
pfn func = (pfn)GetProcAddress(hInst, "LockWorkStation");
if(func) // 调用
(*func)();
FreeLibrary(hInst);
}

解决方案 »

  1.   

    静态更简单,只要把*.lib文件加入workspace,
    就可以直接调用里面的函数
      

  2.   

    不是这意思!应该说是怎样显试调用DLL?
      

  3.   

    还需要有。h文件,同tc一样:)
      

  4.   

    哪就是我的概念有问题了!这样说吧!
    我想用GDI里的AlphaBlend(..)。显试调用好像出了问题,代码如下:
      typedef BOOL  (*ALPHAFUNC)(
                        HDC hdcDest,                 // handle to destination DC
                        int nXOriginDest,            // x-coord of upper-left corner
                        int nYOriginDest,            // y-coord of upper-left corner
                        int nWidthDest,              // destination width
                        int nHeightDest,             // destination height
                        HDC hdcSrc,                  // handle to source DC
                        int nXOriginSrc,             // x-coord of upper-left corner
                        int nYOriginSrc,             // y-coord of upper-left corner
                        int nWidthSrc,               // source width
                        int nHeightSrc,              // source height
                        BLENDFUNCTION blendFunction  // alpha-blending function
                      );
      BLENDFUNCTION   bf;  bf.BlendOp = AC_SRC_OVER;
      bf.BlendFlags = 0;
      bf.SourceConstantAlpha = 200;
      bf.AlphaFormat = 0;//AC_SRC_ALPHA ;  HINSTANCE hInst = LoadLibrary("Msimg32.dll");
      if(hInst)
      {
        ALPHAFUNC AlphaFunc = (ALPHAFUNC)GetProcAddress(hInst, "AlphaBlendA");
        if(AlphaFunc)
          (*AlphaFunc)(m_hdc,50,50,30,30,m_hmemdc,0,0,30,30,bf);
        FreeLibrary(hInst);
      }我想改用隐形的又该怎样?
      

  5.   

    使用DLL分为2中方式:
    1,显示使用:就是LoadLibrary,然后在GetProcAddress一个函数地址,最后用之;2,隐士使用:包含该DLL导出函数的头文件,然后包含编译该DLL时生成的LIB文件,编译之后就用了。我说对了吗
      

  6.   

    包含你的动态库头文件,并将对应Lib库加入工程即可。
      

  7.   

    搞了半天原来是同时带得有一个LIB啊!为什么有了DLL还有LIB呢?唉!!
    不过现在的问题是我上面的程序怎么会出错!