Repository: retep998/winapi-rs (language: rust)

Issue:
Why is DwmDefWindowProc a typedef and not a function? How to call it?
For implementing hit-testing in non-client window areas, the Microsoft docs say to call `DwmDefWindowProc`, so that the DWM can do it's hit-testing for the "close, maximize, minimize" buttons. I'm trying something like https://stackoverflow.com/a/41111488/5317180 with winit.

However, I don't know how I could call `DwmDefWindowProc ` because it is merely a typedef over an `Option<extern fn>` - I tried:

```rust
if let Some(dwm_def_window_proc) = DwmDefWindowProc  {
    let mut hit_test_non_client_area: LRESULT = unsafe { mem::zeroed() };
    if unsafe { wndproc(window, msg, wparam, lparam, &hit_test_non_client_area) } == 0 {
          println!("Close, maximize or minimize button was hit!");
          hit_test_non_client_area
    } else {
          0
    }
}
```

... but this doesn't work as rustc complains `expected value, found type alias`. So I can't get the callback out of the Option - how can I access `DwmDefWindowProc` and call it?

Why is `DwmDefWindowProc` an Option in the first place? - if it has to do something with dynamic loading, can't there just be a function `load_dwm_def_window_proc()` that returns an `Option<extern fn>` - how am I supposed to call this function?


Discussion / hints:
Here seems to be the definition: https://github.com/retep998/winapi-rs/blob/0.3/src/um/dwmapi.rs#L140-L146 - why is it wrapped in a `FN!` macro instead of just being an `extern fn` like all the other functions?
I blame @MSxDOS writing that and myself for not catching that during review. In the headers it is a normal extern function, so I'll have to fix that.

Fix patch:
diff --git a/src/um/dwmapi.rs b/src/um/dwmapi.rs
index 3ee0fb029..9b1be27a8 100644
--- a/src/um/dwmapi.rs
+++ b/src/um/dwmapi.rs
@@ -137,14 +137,14 @@ STRUCT!{#[repr(packed)] struct DWM_PRESENT_PARAMETERS {
     eSampling: DWM_SOURCE_FRAME_SAMPLING,
 }}
 // pub const DWM_FRAME_DURATION_DEFAULT: i32 = -1;
-FN!{stdcall DwmDefWindowProc(
-    hWnd: HWND,
-    msg: UINT,
-    wParam: WPARAM,
-    lParam: LPARAM,
-    plResult: *mut LRESULT,
-) -> BOOL}
 extern "system" {
+    pub fn DwmDefWindowProc(
+        hWnd: HWND,
+        msg: UINT,
+        wParam: WPARAM,
+        lParam: LPARAM,
+        plResult: *mut LRESULT,
+    ) -> BOOL;
     pub fn DwmEnableBlurBehindWindow(
         hWnd: HWND,
         pBlurBehind: *const DWM_BLURBEHIND,


Test patch: