设置窗口背景透明
来源:互联网 发布:java启动参数配置 编辑:程序博客网 时间:2024/05/16 01:55
SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|0x80000);
typedef BOOL (WINAPI *FSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
FSetLayeredWindowAttributes SetLayeredWindowAttributes ;
HINSTANCE hInst = LoadLibrary("User32.DLL");
SetLayeredWindowAttributes = (FSetLayeredWindowAttributes)GetProcAddress(hInst,"SetLayeredWindowAttributes");
if (SetLayeredWindowAttributes)
{
SetLayeredWindowAttributes(GetSafeHwnd(),RGB(0,0,0),128,2);
}
FreeLibrary(hInst);
通过这种方式可以使得窗口背景透明,但同时会使得其子窗口也变得透明。我尝试过使用同样的方式让子窗口不透明也即
SetWindowLong(子窗口句柄,GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|0x80000);
typedef BOOL (WINAPI *FSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
FSetLayeredWindowAttributes SetLayeredWindowAttributes ;
HINSTANCE hInst = LoadLibrary("User32.DLL");
SetLayeredWindowAttributes = (FSetLayeredWindowAttributes)GetProcAddress(hInst,"SetLayeredWindowAttributes");
if (SetLayeredWindowAttributes)
{
SetLayeredWindowAttributes(子窗口句柄,RGB(0,0,0),255,2);
}
FreeLibrary(hInst);
发现行不通
另外SetLayeredWindowAttributes 在 msdn 上虽然可以查到使用说明,但尝试包含声明的头文件并不能找到其声明。
- 设置窗口背景透明
- Qt设置窗口背景透明
- MFC 窗口背景透明
- VC6.0 设置对话框窗口背景为透明
- Windows编程里,怎样设置窗口背景透明
- Flash背景透明(透明背景)设置方法
- png 设置透明背景
- 设置背景透明图片
- 设置Gif背景透明
- UITableView设置背景透明
- iframe背景透明设置
- 设置对话框背景透明
- 设置透明背景1
- 设置button背景透明
- 设置Silverlight背景透明
- 设置iframe背景透明
- 设置透明的背景
- SecureCRT设置背景透明
- IIS配置问题总结
- 云计算的概念
- web.xml、xwork.xml和webwork.properties
- 攻击方式学习之(4) - 拒绝服务(DOS/DDOS/DRDOS)
- [我的Linux技术支持生涯] httpd服务启动成功但是客户端无法连接
- 设置窗口背景透明
- android 自动化测试学习总结
- Navicat Premium 在线使用手册
- linux-Vi使用方法
- Android自定义GridView之实现一个图片加多个文本框
- P2P Blocking
- 产品安全
- ext combo dynamic load store
- gdb读不出core时