//ocx
::SetParent(hWnd, GetDesktopWindow()); //hWnd 为你的窗体句柄。
int width = ::GetSystemMetrics(SM_CXSCREEN);
int height = ::GetSystemMetrics(SM_CYSCREEN);
::MoveWindow(hWnd, 0, 0, width, height, 0);
//win32
VC/Win32应用程序中,想要窗口全屏幕显示的最简单方法:
在ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);前加如下代码:
LONG style = GetWindowLong(hwnd,GWL_STYLE);//获得窗口风格
style = &~WS_CAPTION & ~WS_SIZEBOX;//窗口全屏显示且不可改变大小
SetWindowLong(hwnd,GWL_STYLE,style); //设置窗口风格
int screenX = GetSystemMetrics(SM_CXSCREEN);//获取整个屏幕右下角X坐标
int screenY = GetSystemMetrics(SM_CYSCREEN);//屏幕Y坐标
SetWindowPos(hwnd, NULL,0,0,screenX,screenY,SWP_NOZORDER);//改变窗口位置、尺寸和Z序
ShowCursor(FALSE);//显示时隐藏鼠标