Register
Handmade Hero»Forums»Code»Just started and run into a problem on day 2 !
2 posts
Just started and run into a problem on day 2 !
6 months, 1 week ago Edited by bill256 on Nov. 3, 2020, 12:05 a.m. Reason: Initial post
Hello I just started the handmade hero videos.I have zero coding experience and I run into a problem on day 002 specifically during the debugging of Opening a Win32 Window . Basically I cant interact with the Win32 Window in any way unlike HandmadeHero does on his video . The window just freezes. Could someone take a look at the code and tell me if something is wrong with it or if there is some other issue? I dont know if this is the right place to ask , but thanks in advance . Here is the link to the code: https://pastebin.com/zi24Bs7V
Mārtiņš Možeiko
2219 posts / 1 project
Just started and run into a problem on day 2 !
6 months, 1 week ago
What does "I cant interact with the Win32 Window" and "window just freezes" mean? I compiled your code and can move window, resize it, maximize it just fine. You cannot close it, but that's because you aren't fully handling WM_CLOSE & WM_DESTROY messages.
16 posts
Just started and run into a problem on day 2 !
6 months, 1 week ago
If you can't interact with the window at all with the code you posted (minimize, maximize, resizing, repositioning), then it sounds like your program is paused in the debugger and you need to run it by doing Debug->Continue (F5).

If you just mean the X close button doesn't close the window then the issue is the following.

Inside your switch statement you have added debug code which is preventing the default case from being ran, which probably isn't intended.
1
2
3
4
case WM_CLOSE:
{
    OutputDebugStringA("WM_CLOSE");
}break;


If you want the X close button to close the window, then you should either let the default case run or handle the message yourself by calling DestroyWindow for example.