| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use utf8; |
| 4 |
use FFI::Platypus 2.00; |
| 5 |
|
| 6 |
my $ffi = FFI::Platypus->new( |
| 7 |
api => 2, |
| 8 |
lib => [undef], |
| 9 |
); |
| 10 |
|
| 11 |
# see FFI::Platypus::Lang::Win32 |
| 12 |
$ffi->lang('Win32'); |
| 13 |
|
| 14 |
# Send a Unicode string to the Windows API MessageBoxW function. |
| 15 |
use constant MB_OK => 0x00000000; |
| 16 |
use constant MB_DEFAULT_DESKTOP_ONLY => 0x00020000; |
| 17 |
$ffi->attach( [MessageBoxW => 'MessageBox'] => [ 'HWND', 'LPCWSTR', 'LPCWSTR', 'UINT'] => 'int' ); |
| 18 |
MessageBox(undef, "I ❤️ Platypus", "Confession", MB_OK|MB_DEFAULT_DESKTOP_ONLY); |
| 19 |
|