1、创建一个基于对话框的MFC EXE 2、在对话框的 OnInitDialog 函数 中,设置对话框扩展属性 为:WS_EX_LAYERED const WS_EX_LAYERED = 0x80000; ::SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE, 3、在对话框的 OnInitDialog 函数 中,设置对话框透明 HINSTANCE hInst; const LWA_COLORKEY = 0x00001; typedef BOOL (WINAPI *FSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); hInst = LoadLibrary("User32.dll"); SetLayeredWindowAttributes = (FSetLayeredWindowAttributes) SetLayeredWindowAttributes(GetSafeHwnd(),RGB(0,0,0),150,LWA_ALPHA); FreeLibrary(hInst); 注:此方法仅适用 Windows2000以上平台
补充部分:
|