现在的位置: 首页 > 综合 > 正文

VC调用DLL库方法的方法

2012年10月20日 ⁄ 综合 ⁄ 共 382字 ⁄ 字号 评论关闭
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方法,可以设置窗体颜色和透明度。



抱歉!评论已关闭.