Win32 examples don't show the title
The win32 examples that handle the WM_NCCREATE event without using DefWindowProcW don't have their non-client area drawn properly, which means that they don't get the title text drawn.
Hello, I've been following your tutorial and this has been bugging me.
After reading up, various sources say to either set the return of WM_NCCREATE into DefWindowProcW or just not handle it.
I haven't gotten to the OpenGL part of the tutorial. but
WM_NCCREATE => {
println!("NC Create");
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
WM_CREATE => {
println!("Create");
let createstruct: *mut CREATESTRUCTW = lparam as *mut _;
if createstruct.is_null() {
return 0;
}
let ptr = (*createstruct).lpCreateParams as *mut i32;
return set_window_userdata(hwnd, ptr).is_ok() as LRESULT;
}
this works with no errors.
alternatively this also works.
WM_NCCREATE => {
println!("NC Create");
let createstruct: *mut CREATESTRUCTW = lparam as *mut _;
if createstruct.is_null() {
return 0;
}
let ptr = (*createstruct).lpCreateParams as *mut i32;
let _ = set_window_userdata(hwnd, ptr).is_ok();
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
WM_CREATE => {
println!("Create");
}
let _ = set_window_userdata(hwnd, ptr).is_ok(); I am not entirely sure what the ramifications, ignoring this result has, so I went with the first version.
Oh, yeah, that all sounds right. Either I learned about this by the end of the tutorial, or maybe after I wrote the tutorial. The gitbook search is pretty bad so i can't tell if this gets talked about eventually.
If you get to the end of the tutorial and it still hasn't mentioned this, then feel free to open a PR and I can get it merged.