Skip to content

Commit 826a5e9

Browse files
authored
Update lpfnWndProc to use window_procedure earlier & Remove return to help reproduce printed error (#33)
* Reproducing the printed messages after this code snippet requires removal of this return. * Update lpfnWndProc to use window_procedure earlier. * use code snippet
1 parent 8ae7818 commit 826a5e9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

book_src/opening_a_window/win32.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,15 @@ pub unsafe extern "system" fn window_procedure(
14061406
}
14071407
```
14081408

1409+
And update our window class to use `window_procedure`:
1410+
```rust
1411+
fn main() {
1412+
// ...
1413+
wc.lpfnWndProc = Some(window_procedure);
1414+
// ...
1415+
}
1416+
```
1417+
14091418
Window looks the same as before,
14101419
but if we fiddle with the brush value we can see it'll draw using other colors.
14111420
Doesn't seem to fix the mouse though.
@@ -1458,7 +1467,6 @@ And we check for them in our window procedure:
14581467
match Msg {
14591468
WM_NCCREATE => {
14601469
println!("NC Create");
1461-
return 1;
14621470
}
14631471
WM_CREATE => println!("Create"),
14641472
```

0 commit comments

Comments
 (0)