'WIN32 CPP Creating a window 400 x 400 creates a window smaller

RECT WindowMainRect{ 0, 0, 400, 400 };
HWND WindowMain;
HWND WindowChild;
INT main()
{
    AdjustWindowRectEx(&WindowMainRect, WS_SYSMENU, FALSE, 0);
    WNDCLASS WindowMainClass;
    memset(&WindowMainClass, 0, sizeof(WNDCLASS));
    WindowMainClass.lpfnWndProc     = WindowMainProcedure;
    WindowMainClass.lpszClassName   = L"WindowMain";
    if (!RegisterClass(&WindowMainClass)) MessageBox(NULL, L"Error", L"Register Class Error", MB_ICONWARNING);
    WindowMain = CreateWindowEx(0, L"WindowMain", L"Window", WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, WindowMainRect.right, WindowMainRect.bottom, NULL, NULL, NULL, NULL);
    ShowWindow(WindowMain, TRUE);
    WindowChild = CreateWindow(L"Edit", NULL, WS_CHILD | WS_BORDER, 0, 0, 350, 350, WindowMain, NULL, NULL, NULL);
    ShowWindow(WindowChild, TRUE);
    MSG Msg;
    Msg.message = WM_NULL;
    while (Msg.message != WM_QUIT)
    {
        if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
    }
}

The code above creates a window by 400 x 400 and adjusted by WS_SYSMENU.
Assumptively, the client area of this window should be 400 x 400 pixels with a 1:1 aspect ratio,
I create a child window at (0,0) with the width of 350, and height of 350.
Although, visibly the client area is not 1:1 and is vertically stretched.
Using photoshop I counted the pixels, I expected it to be above 400 pixels vertically and 400 pixels horizontally,
Although the results returned ~386 pixels in width, and ~394 pixels in height.
Window picture

How do I fix this and have the client area 1:1?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source