#define WS_EX_LAYERED 0x00080000
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
typedef BOOL (*_SetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
_SetLayeredWindowAttributes SetLayeredWindowAttributes;
void SetLayered(HWND hWnd,int Pos)
{
SetLayeredWindowAttributes = (_SetLayeredWindowAttributes)GetProcAddress(GetModuleHandle("user32.dll"),"SetLayeredWindowAttributes");
if ( SetLayeredWindowAttributes == NULL )
return ;
else{
__try{
SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)|WS_EX_LAYERED);
SetLayeredWindowAttributes(hWnd,RGB(0,0,0),Pos,LWA_ALPHA);
}
__except(EXCEPTION_EXECUTE_HANDLER){
AfxMessageBox("SYSTEM FALSE");
}
}
}
本文地址:http://com.8s8s.com/it/it4013.htm