#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");}}}