typedef BOOL (FAR WINAPI *LAYERFUNC)(HWND,COLORREF,BYTE,DWORD);
BOOL SetLayeredWindowAttributes(HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags)
{
LAYERFUNC SetLayer;
HMODULE hmod = LoadLibrary("user32.dll");
SetLayer=(LAYERFUNC)GetProcAddress(hmod,"SetLayeredWindowAttributes");
BOOL bReturn = SetLayer(hwnd,crKey,bAlpha,dwFlags);
FreeLibrary(hmod);
return bReturn;
}
//设置窗口透明
int rtn = GetWindowLong(hWnd, -20);
rtn = rtn | WS_EX_LAYERED;
SetWindowLong(hWnd, -20, rtn);
//SetLayeredWindowAttributes(hWnd,RGB(255,255,255),180,2);
SetLayeredWindowAttributes(hWnd,RGB(255,255,255),0,1);