From 22d9fbbbdf7132f892c8b5efde4c50dc620e8261 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 18 Oct 2025 11:08:37 +0100 Subject: [PATCH 1/3] Reproducing the printed messages after this code snippet requires removal of this return. --- book_src/opening_a_window/win32.md | 1 - 1 file changed, 1 deletion(-) diff --git a/book_src/opening_a_window/win32.md b/book_src/opening_a_window/win32.md index 5390e23..9fe4934 100644 --- a/book_src/opening_a_window/win32.md +++ b/book_src/opening_a_window/win32.md @@ -1458,7 +1458,6 @@ And we check for them in our window procedure: match Msg { WM_NCCREATE => { println!("NC Create"); - return 1; } WM_CREATE => println!("Create"), ``` From debfc6b672c00d079eade94bdcb2ded8ad5fab3b Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 18 Oct 2025 11:15:17 +0100 Subject: [PATCH 2/3] Update lpfnWndProc to use window_procedure earlier. --- book_src/opening_a_window/win32.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/book_src/opening_a_window/win32.md b/book_src/opening_a_window/win32.md index 9fe4934..dd8fe7b 100644 --- a/book_src/opening_a_window/win32.md +++ b/book_src/opening_a_window/win32.md @@ -1406,6 +1406,15 @@ pub unsafe extern "system" fn window_procedure( } ``` +And update our window class to use window_procedure: +```rust +fn main() { + // ... + wc.lpfnWndProc = Some(window_procedure); + // ... +} +``` + Window looks the same as before, but if we fiddle with the brush value we can see it'll draw using other colors. Doesn't seem to fix the mouse though. From 4eb3cc82f6b7e31be53c43e2a6dc3d51910a1120 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 18 Oct 2025 11:18:52 +0100 Subject: [PATCH 3/3] use code snippet --- book_src/opening_a_window/win32.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book_src/opening_a_window/win32.md b/book_src/opening_a_window/win32.md index dd8fe7b..786b755 100644 --- a/book_src/opening_a_window/win32.md +++ b/book_src/opening_a_window/win32.md @@ -1406,7 +1406,7 @@ pub unsafe extern "system" fn window_procedure( } ``` -And update our window class to use window_procedure: +And update our window class to use `window_procedure`: ```rust fn main() { // ...