GDI 全屏怎么样改成窗体

C语言 码拜 9年前 (2016-04-11) 904次浏览
int WINAPI WinMain(HINSTANCE hCurrentInst,HINSTANCE hPrevInstance,PSTR lpszCmdLine,int nCmdShow)
{
WNDCLASS wndClass;
HWND hWnd;
MSG msg;
UINT width;
UINT height;
ScreenW=GetSystemMetrics(SM_CXSCREEN);
ScreenH=GetSystemMetrics(SM_CYSCREEN);
PicInst();
RoomInst();
wndClass.style=CS_HREDRAW|CS_VREDRAW;
wndClass.lpfnWndProc=WndProc;
wndClass.cbClsExtra=0;
wndClass.cbWndExtra=0;
wndClass.hInstance=hCurrentInst;
wndClass.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_MAIN));
wndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName=NULL;
wndClass.lpszClassName=”BasicApp”;
RegisterClass(&wndClass);
width=GetSystemMetrics(SM_CXSCREEN);
height=GetSystemMetrics(SM_CYSCREEN);
hWnd=CreateWindow(
“BasicApp”,
“Basic Applicaton”,
WS_POPUP|WS_MAXIMIZE,
0,0,
width,height,
NULL,NULL,
hCurrentInst,NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg,NULL,0,0))
{
nowTick=GetTickCount();
if(nowTick-showTick>33&&!IsOver)
{
Show(bufferDC);
BitBlt(windowDC,0,0,ScreenW,ScreenH,bufferDC,0,0,SRCCOPY);
showTick=nowTick;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
解决方案

20

引用:

ScreenW=GetSystemMetrics(SM_CXSCREEN);
ScreenH=GetSystemMetrics(SM_CYSCREEN);
width=GetSystemMetrics(SM_CXSCREEN); //屏幕宽度改成你需要的窗口宽度(客户区宽度+两边沿)
height=GetSystemMetrics(SM_CYSCREEN);  //屏幕高度改成你需要的窗口高度(客户区高度+标题栏+菜单栏+边沿)
hWnd=CreateWindow(
“BasicApp”,
“Basic Applicaton”,
WS_POPUP|WS_MAXIMIZE,
0,0,
width,height,
NULL,NULL,
hCurrentInst,NULL);

WS_POPUP|WS_MAXIMIZE  可以改成  WS_OVERLAPPEDWINDOW ,窗口样式参数很多,具体要查MSDN

20

GDI 全屏怎么样改成窗体

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明GDI 全屏怎么样改成窗体
喜欢 (0)
[1034331897@qq.com]
分享 (0)