I am currently a noob for Win32 API and learning it. I want to learn how can we set the position of a button control to be exactly in the middle of the main window.
I am just creating a simple button like this in the WM_CREATE message of the WndProc function :-
HWND hBtn;
hBtn = CreateWindow
(
L"Button", L"Hello",
WS_VISIBLE | WS_CHILD,
0, 0, 125, 50,
hWnd, NULL, NULL, NULL
);
Note that hBtn is globally defined.
I am just subclassing the button control to get the hand cursor while hovering it. Its pretty simple.
SetWindowSubclass (hBtn, ButtonSubclass, NULL, NULL);
At last I just want the button to be exactly in the middle of the screen when the window is resized.