Mercurial > dwindows
annotate win/wintoast.cpp @ 2104:6e55c6f8d816
Added initial notification callback code to the test program.
Win: Added initial notification callback handler glue and fixed a memory leak.
The activation callbacks do not seem to be triggering so added some debug code to test.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 16 Jun 2020 00:16:59 +0000 |
parents | 665d87a50eac |
children | 35abef6e33a9 |
rev | line source |
---|---|
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* Simple WinToast forwarder from Dynamic Windows APIs */ |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 #include "wintoastlib.h" |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 using namespace WinToastLib; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
7 extern "C" { |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
8 LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
9 void dw_signal_disconnect_by_window(HWND window); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
10 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
11 void dw_debug(const char *format, ...); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
12 #endif |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
13 } |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
14 |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
15 class DWHandler : public IWinToastHandler { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 public: |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
17 WinToastTemplate *templ; |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
18 |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 void toastActivated() const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 // The user clicked in this toast |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
21 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
22 dw_debug("Sending notification to DW eventhandler\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
23 #endif |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
24 _wndproc((HWND)templ, WM_USER+102, 0, 0); |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 void toastActivated(int actionIndex) const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 // The user clicked on action |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
29 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
30 dw_debug("Sending notification to DW eventhandler via action\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
31 #endif |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
32 _wndproc((HWND)templ, WM_USER+102, 0, 0); |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 void toastDismissed(WinToastDismissalReason state) const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 switch (state) { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 case UserCanceled: |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
38 // The user dismissed this toast |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
39 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
40 dw_debug("The user dismissed this toast\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
41 #endif |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
42 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
43 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 case TimedOut: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
45 // The toast has timed out |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
46 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
47 dw_debug("The toast has timed out\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
48 #endif |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
49 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 case ApplicationHidden: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
51 // The application hid the toast using ToastNotifier.hide() |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
52 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
53 dw_debug("The application hid the toast using ToastNotifier.hide()\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
54 #endif |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 default: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 // Toast not activated |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
58 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 void toastFailed() const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 // Error showing current toast |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
64 #ifdef DEBUG |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
65 dw_debug("Toast failed freeing template\n"); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
66 #endif |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
67 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 }; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 enum Results { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 ToastClicked, // user clicked on the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 ToastDismissed, // user dismissed the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 ToastTimeOut, // toast timed out |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 ToastHided, // application hid the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 ToastNotActivated, // toast was not activated |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
78 ToastFailed, // toast failed |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
79 SystemNotSupported, // system does not support toasts |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 UnhandledOption, // unhandled option |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 MultipleTextNotSupported, // multiple texts were provided |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 InitializationFailure, // toast notification manager initialization failure |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 ToastNotLaunched // toast could not be launched |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
84 }; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
85 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
86 extern "C" { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
88 void _dw_toast_init(LPWSTR AppName, LPWSTR AppID) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 WinToast::instance()->setAppName(AppName); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 WinToast::instance()->setAppUserModelId(AppID); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 WinToast::instance()->initialize(); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
95 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 void *_dw_notification_new(LPWSTR title, LPWSTR image, LPWSTR description) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
99 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
101 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
102 WinToastTemplate *templ = new WinToastTemplate(image ? WinToastTemplate::ImageAndText02 : WinToastTemplate::Text02); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
103 templ->setTextField(title, WinToastTemplate::FirstLine); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
104 templ->setAttributionText(description); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
105 if(image) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
106 templ->setImagePath(image); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
107 return (void *)templ; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
108 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
109 return NULL; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
110 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 int _dw_notification_send(void *notification) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
113 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
116 WinToastTemplate *templ = (WinToastTemplate *)notification; |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
117 DWHandler *handler = new DWHandler(); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
118 handler->templ = templ; |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
119 |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
120 if(templ && WinToast::instance()->showToast(*templ, handler) >= 0) |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
121 return 0; // DW_ERROR_NONE |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
122 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
123 return -1; // DW_ERROR_UNKNOWN |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
124 } |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
125 |
2098
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
126 BOOL _dw_toast_is_compatible(void) |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
127 { |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
128 return WinToast::isCompatible(); |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
129 } |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
130 } |