Skip to content

Commit 4bf0e5a

Browse files
committed
adding extern msgbox example
1 parent 2c82e02 commit 4bf0e5a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Exec_Extern/MessageBox.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Just an sample Example of using using extern to Run MessageBoxA ..!
2+
// Create an Function with the help of Microsoft Documentation !
3+
4+
use std::ptr::null_mut;
5+
6+
extern "system" {
7+
fn MessageBoxA(
8+
hWnd: *mut std::ffi::c_void,
9+
lpText: *const u8,
10+
lpCaption: *const u8,
11+
uType: u32,
12+
) -> i32;
13+
}
14+
15+
fn main() {
16+
let text = b"Hello Nerds..\0".as_ptr();
17+
let caption = b"Meow_Meow\0".as_ptr();
18+
19+
unsafe {
20+
MessageBoxA(null_mut(), text, caption, 0x00000000);
21+
}
22+
}

Exec_Extern/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
## Execute winapi functions without using windows or winapi crates by calling the functins from the External Library ie original lib that was written in C/C++.
1+
### Execute winapi functions without using windows or winapi crates by calling the functins from the External Library ie original lib that was written in C/C++.
2+
3+

0 commit comments

Comments
 (0)