在**Dlg.cpp的OnInitDialog()函数中添加下面代码即可:
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");
COLORREF colorkey=14215660;
if (fun )
fun(this->GetSafeHwnd(),colorkey,0,1);
FreeLibrary(hInst);
}
当然,这样标题栏不会隐藏,要想使标题栏也隐藏,再另行设置即可!
源码下载(不是我写的):
http://www.pudn.com/downloads91/sourcecode/windows/dialog/detail348712.html