When using the windows SDK to compile a program writen in C++, if I specify -subsystem:windows,6.1
,
the width of the window is smaller. If I don't, or do -subsystem:windows
without the 6.1
, the width is normal.
I'm curious why this does this, and if there's a way to make it stay the same width regardless of what command line I pass to link.
EDIT: So it's also height, height and width are both different. And if i look at it with Inspect.exe, it says the size is the same each time.
EDIT2: Also it's a window application created with CreateWindow, not a console.
EDIT3: Here's the full code that initializes my window:
wcex.cbSize = sizeof(WND开发者_JS百科CLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(SMALL_ICON));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = g_szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(SMALL_ICON));
g_hMainWnd = CreateWindow(
g_szWindowClass,
t_szWindowTitle,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT,
392, 250,
NULL,
NULL,
hInstance,
NULL
);
And I resize the window with this:
SetWindowPos(hWnd, NULL,
(GetSystemMetrics(SM_CXFULLSCREEN)/2)- (392/2),
(GetSystemMetrics(SM_CYFULLSCREEN)/2) - (250/2),
392, 120, SWP_NOZORDER);
I'm suspecting you are specifying some windows styles that are only supported in Windows7 (Win7 = 6.1). Post the full CreateWindow call with arguments and also try turning off Aero. The window border may be included in the width/height for example in one scenario.
精彩评论