设置对话框的透明度

来源:互联网 发布:2017淘宝卖家必备软件 编辑:程序博客网 时间:2024/05/16 12:30
SetTransparence(int value){SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE) | 0x80000);                     //设置窗口扩展风格typedef BOOL (WINAPI *FSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);FSetLayeredWindowAttributes SetLayeredWindowAttributes;//声明函数HINSTANCE hInst = LoadLibrary(_T("User32.DLL"));//加载User32.DLLSetLayeredWindowAttributes = (FSetLayeredWindowAttributes)GetProcAddress(hInst,"SetLayeredWindowAttributes");if(SetLayeredWindowAttributes)SetLayeredWindowAttributes(GetSafeHwnd(),RGB(0,0,0),value,2);            //根据value的值设置窗体透明度FreeLibrary(hInst);//释放动态链接库}
原创粉丝点击