-
-
Notifications
You must be signed in to change notification settings - Fork 126
/
Copy pathmsgbox.dart
36 lines (30 loc) · 824 Bytes
/
msgbox.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Demonstrates displaying a MessageBox with a warning icon and three buttons.
import 'package:ffi/ffi.dart';
import 'package:win32/win32.dart';
void main() {
final lpCaption = 'Dart MessageBox Demo'.toNativeUtf16();
final lpText =
'''
This is not really an error, but we are pretending for the sake of this demo.
Resource error.
Do you want to try again?
'''.toNativeUtf16();
final result = MessageBox(
NULL,
lpText,
lpCaption,
MB_ICONWARNING | // Warning icon
MB_CANCELTRYCONTINUE | // Action button
MB_DEFBUTTON2, // Second button is the default
);
free(lpText);
free(lpCaption);
switch (result) {
case IDCANCEL:
print('Cancel pressed');
case IDTRYAGAIN:
print('Try Again pressed');
case IDCONTINUE:
print('Continue pressed');
}
}