According to this blog entry by Raymond Chen, Windows NT "minimized" windows by moving them to the coordinates (-32000, -32000), and, I got the impression from reading it that this was the case in the early versions of Windows NT (3.x, 4...).
In modern versions of Windows NT (such as 7, 8, and 10), is this still the case?
Is there a program that one could write to demonstrate the presence/absence of this feature on a modern Windows OS?
Answering my own question... I've written a small C program that does what I asked. Basically, it creates a window with code such that if the window's position ever changes to a negative value in either the x or y dimension, it will set the text of a static text field to the new coordinates.
Output of this program on Windows 10 RTM:
#include <Windows.h>
#include <tchar.h>
#include <strsafe.h>
TCHAR g_szClassName[] = _T("CoordReportWnd");
LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam);
ATOM RegisterWCEX(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
ZeroMemory(&wcex, sizeof(WNDCLASSEX));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = WindowProc;
wcex.hInstance = hInstance;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = g_szClassName;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)COLOR_WINDOW;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.style = 0;
return RegisterClassEx(&wcex);
}
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
{
HFONT hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hWnd, WM_SETFONT, (WPARAM)hfDefault, 0);
return TRUE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HWND hWnd, hStatic;
MSG Msg;
if (!RegisterWCEX(hInstance))
{
MessageBox(0, _T("Window registration failed!"), _T("Error"), MB_ICONSTOP);
return -1;
}
hWnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, g_szClassName, _T("Minimize Me"), WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX, 100, 100, 200, 150, NULL, NULL, GetModuleHandle(NULL), NULL);
hStatic = CreateWindow(_T("Static"), _T(""), WS_VISIBLE | WS_CHILD, 10, 10, 180, 20, hWnd, NULL, GetModuleHandle(NULL), NULL);
ShowWindow(hWnd, SW_SHOW);
EnumChildWindows(hWnd, EnumChildProc, 0L);
UpdateWindow(hWnd);
while (GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_WINDOWPOSCHANGED:
{
PWINDOWPOS pWP = (PWINDOWPOS)lParam;
if (pWP->x < 0 || pWP->y < 0)
{
TCHAR stTxt[64];
HWND hStatic = FindWindowEx(hWnd, NULL, _T("Static"), NULL);
StringCchPrintf(stTxt, 64, _T("(%d, %d)"), pWP->x, pWP->y);
SetWindowText(hStatic, stTxt);
}
}
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}
When run, if minimized and then re-maximized, it displays (-32000, -32000), indicating that that's where the window has been moved to when it was minimized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With