@@ -26,19 +26,24 @@ This will allow Cargo to download, build, and cache Windows support as a package
26
26
fn main () {
27
27
windows :: build! (
28
28
windows :: data :: xml :: dom :: *
29
- windows :: ui :: *
29
+ windows :: win32 :: system_services :: {CreateEventW , SetEvent , WaitForSingleObject }
30
+ windows :: win32 :: windows_programming :: CloseHandle
30
31
);
31
32
}
32
33
```
33
34
34
- Finally, make use of any Windows APIs as needed. For example, here is an example of using the ` XmlDocument ` class to parse an XML document.
35
+ Finally, make use of any Windows APIs as needed.
35
36
36
37
``` rust
37
38
mod bindings {
38
39
:: windows :: include_bindings! ();
39
40
}
40
41
41
- use bindings :: windows :: data :: xml :: dom :: XmlDocument ;
42
+ use bindings :: {
43
+ windows :: data :: xml :: dom :: * ,
44
+ windows :: win32 :: system_services :: {CreateEventW , SetEvent , WaitForSingleObject },
45
+ windows :: win32 :: windows_programming :: CloseHandle ,
46
+ };
42
47
43
48
fn main () -> windows :: Result <()> {
44
49
let doc = XmlDocument :: new ()? ;
@@ -48,6 +53,19 @@ fn main() -> windows::Result<()> {
48
53
assert! (root . node_name ()? == " html" );
49
54
assert! (root . inner_text ()? == " hello world" );
50
55
56
+ unsafe {
57
+ let event = CreateEventW (
58
+ std :: ptr :: null_mut (),
59
+ true . into (),
60
+ false . into (),
61
+ std :: ptr :: null (),
62
+ );
63
+
64
+ SetEvent (event ). ok ()? ;
65
+ WaitForSingleObject (event , 0 );
66
+ CloseHandle (event ). ok ()? ;
67
+ }
68
+
51
69
Ok (())
52
70
}
53
71
```
0 commit comments