Good morning,
Out of curiosity, tried to calculate the width and height of a
Windows message box, but the value of r->right (only r->right)
varies from session to session.
r->left = 0, obviously;
r->top = 0, obviously;
r->right = 0(!), 117, 118 (the most frequent), 124, 177, etc.;
r->bottom = 15;
I ask my colleagues who program for Windows to review what's wrong
with this code and all the others to run it in order to see if r-
>right varies so greatly.
If anyone has a proven recipe to work out the dimensions of a
message box, it would be highly welcomed.
#include <windows.h>
#include <stdio.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
HWND hwnd = FindWindow(NULL, "");
LPRECT r;
GetClientRect(hwnd, r);
char b[128];
sprintf(b, "%d %d %d %d (left, top, right, bottom)",
r->left, r->top, r->right, r->bottom);
MessageBox(NULL, b, "Message Box", MB_OK);
return 0;
}
Best,
Geraldo