希望大虾们最好是贴点源代码,谢谢!
解决方案 »
- 关于在网络中获取主机名
- 如何实现一个vc那样的界面
- 有教育网的用户吗?help 一个25分
- 简单问题:程序的运行问题
- 把编辑框中的字符串,写入文件的问题???
- 編譯jeffrey richter的FileRev程序出錯,"you are not using the latest Platform SDK header/library ",為什么?
- GetSafeHdc() 的含义及用法
- 请高手帮我分析一下这段代码是何压缩程序所压缩?参者均有分!
- 怎么做到在一个已经好的程序中加入另一个程序!可加分!
- 单精度浮点数与双精度浮点数的,划分规则时什么。为什么。
- VC多文档程序运行时,如何自动新建一个最大化文档
- 怎么让程序只允许一个
http://hi.baidu.com/130503/blog/item/0f504123a724d342ac34dee3.html
设置窗体透明
{
#define LWA_COLORKEY 0x00000001
#define WS_EX_LAYERED 0x00080000
#define LWA_ALPHA 0x00000002
#define GWL_EXSTYLE -20
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes; HMODULE hUser32 = GetModuleHandle("user32.dll");
SetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress(hUser32,"SetLayeredWindowAttributes"); SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(GetSafeHwnd(), 0, Trans, LWA_ALPHA);
FreeLibrary(hUser32);}
我曾经仿QQ界面时,写的改变透明度的函数!希望对你有用!
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes = NULL;{
if (!g_pSetLayeredWindowAttributes)
{
HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL"));
g_pSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)
GetProcAddress(hUser32, "SetLayeredWindowAttributes");
if (g_pSetLayeredWindowAttributes)
{
SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
}
else return ;
}
g_pSetLayeredWindowAttributes(m_hWnd, 0, bAlpha, LWA_ALPHA);
}
这个不知道可不可以