我想在我的程序中再创建一个小的窗口显示在屏幕的右下角,就像迅雷每次打开后弹出的那个透明窗口的广告一样,请问我要让哪个类作为这个小窗口的基类,具体如何实现啊,各位帮帮忙
解决方案 »
- 贴图双缓冲问题,求解!
- CArray如何删除重复的项
- 日期事件选取器(CDateTimeCtrl )初始化空白问题
- 请问如何判断字符串中含有非ASC吗字符?????
- 一个COM基本问题
- 关于CListCtrl中SetItemData的问题
- 怎样实现RoundRect??
- 有关CreateProcess或ShellExecute
- 怎样把VC的文本控件做成透明的,可以显示背景图片
- 请问 extern "C" 在什么时候是必需的啊,我想在VC++环境下开发动态库,然后给C++builder使用
- MFC数据库与combo控件关联问题!!~~~!!
- LINK : fatal error LNK1104: cannot open file 'mfc42.lib'
www.vckbase.com上的代码:SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
HINSTANCE hInst = LoadLibrary("User32.DLL");
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
//取得SetLayeredWindowAttributes函数指针
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
if(fun)fun(this->GetSafeHwnd(),0,128,2);
FreeLibrary(hInst);
}
::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
HINSTANCE hinstance = LoadLibrary("User32.dll");
if(NULL != hinstance)
{
typedef BOOL (WINAPI*MyFunc)(HWND,COLORREF,BYTE,DWORD);
MyFunc pFunc = NULL;
pFunc = (MyFunc)GetProcAddress(hinstance,"SetLayeredWindowAttributes");
if(pFunc != NULL)
{
pFunc(this->GetSafeHwnd(),0,128/*透明度0-255*/,2);
}
FreeLibrary(hinstance);
}VC6.0下测试没问题
不过注意,你不能直接使用MFC头文件中定义的那个,因为在win2000(好像就是这个是分界线)之前的系统中没有这个接口,就不能调用
另外,需要注意窗口的样式,必需为OVERLAP类型
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
//取得SetLayeredWindowAttributes函数指针
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
if(fun)fun(this->GetSafeHwnd(),0,128,2);
FreeLibrary(hInst);
}
如果是在VC.NET中的话,上面的代码可以简化为
SetLayeredWindowAttributes(0,128,2);
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
//取得SetLayeredWindowAttributes函数指针
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
if(fun)fun(this->GetSafeHwnd(),0,128,2);
FreeLibrary(hInst);
}
这个方法是可以,但有限于Dialog。