VC调用DLL库方法的方法

void CFloatWnd::OnUpdateTransparent(int iTransparent)

{



HINSTANCE hInst = LoadLibrary("User32.DLL");

if(hInst)

{

  typedef BOOL (WINAPI *SLWA)(HWND,COLORREF,BYTE,DWORD);

  SLWA pFun = NULL;

  //取得SetLayeredWindowAttributes函数指针 

  pFun = (SLWA)GetProcAddress(hInst,"SetLayeredWindowAttributes");

  if(pFun)

  {

  pFun(m_hWnd,0,iTransparent,2);

  }

  FreeLibrary(hInst); 

} 

}



调用User32.DLL里面的SetLayeredWindowAttributes方法,可以设置窗体颜色和透明度。







你可能感兴趣的:(dll)