You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After retargeting this project for VS 2022 and fixing a few minor issues (e.g. min() max() macros defined in Common.h conflicting with std functions), the project builds. However, when run, a main window is show with no client content, and then after some seconds the app automatically terminates.
On debugging, it is consistently throwing an exception before it has finished initializing (in MainWindow::Initialize()).
The implementation has a MainWindow class that holds the hwnd (and other stuff in protected members). When the call to CreateWindow() returns, it is not setting hwnd_; rather, a pointer to the MainWindow object is passed so that the object can be retrieved when WM_NCCreate is processed and hwnd_ is set then.
However, when ShowWindow() is called, a WM_SIZE message gets processed, and the OnSize() handler calls GetClientRect(hwnd_, &rect)
which throws because hwnd_ isn't set or can't be accessed. I tried changing the OnSize() signature to pass down the hwnd, but that still didn't work. I don't understand why a method within the MainWindow object can't access the hwnd_ protected member within that object.
The text was updated successfully, but these errors were encountered:
After retargeting this project for VS 2022 and fixing a few minor issues (e.g. min() max() macros defined in Common.h conflicting with std functions), the project builds. However, when run, a main window is show with no client content, and then after some seconds the app automatically terminates.
On debugging, it is consistently throwing an exception before it has finished initializing (in
MainWindow::Initialize()
).The implementation has a MainWindow class that holds the hwnd (and other stuff in protected members). When the call to
CreateWindow()
returns, it is not setting hwnd_; rather, a pointer to the MainWindow object is passed so that the object can be retrieved whenWM_NCCreate
is processed and hwnd_ is set then.However, when
ShowWindow()
is called, a WM_SIZE message gets processed, and theOnSize()
handler callsGetClientRect(hwnd_, &rect)
which throws because hwnd_ isn't set or can't be accessed. I tried changing the
OnSize()
signature to pass down the hwnd, but that still didn't work. I don't understand why a method within the MainWindow object can't access the hwnd_ protected member within that object.The text was updated successfully, but these errors were encountered: