19 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
* |
* |
21 |
*/ |
*/ |
|
|
|
|
/* |
|
|
* ChangeLog |
|
|
* Maybe I didn't understand how to use the code, but the original code |
|
|
* always produces a window near the taskbar icon. This is not very useful |
|
|
* because we need it near the dialog. I also removed some code we don't use. |
|
|
* -ts |
|
|
*/ |
|
|
|
|
22 |
#include <windows.h> |
#include <windows.h> |
23 |
|
|
24 |
#include "wptW32API.h" |
#include "wptW32API.h" |
25 |
|
|
26 |
#define PD_WINDOWNAME "ClsTrayPop" |
#define PD_WINDOWNAME "ClsTrayPop" |
27 |
#define PD_TIMER_IDENTIFIER 23 |
#define PD_TIMER_IDENTIFIER 23 |
28 |
#define PD_TIMER_TIMEOUT 1500 |
#define PD_TIMER_TIMEOUT 1500 |
29 |
|
|
30 |
#define PD_TRAYPOP_WIDTH 200 |
/* XXX: use the given text to figure out these params. */ |
31 |
#define PD_TRAYPOP_HEIGHT 80 |
#define PD_TRAYPOP_WIDTH 250 |
32 |
|
#define PD_TRAYPOP_HEIGHT 80 |
33 |
|
|
34 |
extern HINSTANCE glob_hinst; |
extern HINSTANCE glob_hinst; |
35 |
extern HWND glob_hwnd; |
extern HWND glob_hwnd; |
36 |
|
|
37 |
|
|
38 |
static LPCTSTR |
static LPCTSTR |
39 |
store_text( LPCTSTR alert_text ) |
store_text (LPCTSTR alert_text) |
40 |
{ |
{ |
41 |
static LPCTSTR text; |
static LPCTSTR text; |
42 |
|
|
43 |
if( alert_text ) |
if (alert_text) |
44 |
text = alert_text; |
text = alert_text; |
45 |
return text; |
return text; |
46 |
} /* store_text */ |
} /* store_text */ |
192 |
WS_POPUP, // window style |
WS_POPUP, // window style |
193 |
(parent.right + parent.left) / 2, (parent.bottom + parent.top) / 2, |
(parent.right + parent.left) / 2, (parent.bottom + parent.top) / 2, |
194 |
nWndWidth - 2, nWndHeight - 2, // width and height, with corrections |
nWndWidth - 2, nWndHeight - 2, // width and height, with corrections |
195 |
NULL, // parent handle |
NULL, NULL, glob_hinst, NULL); |
196 |
NULL, // menu handle |
|
|
glob_hinst, // instance handle |
|
|
NULL // other parameters |
|
|
); |
|
197 |
|
|
198 |
if (hWnd == NULL) |
if (hWnd == NULL) |
199 |
return 0; |
return 0; |
200 |
else { |
else { |
201 |
ShowWindow (hWnd, SW_SHOW); |
ShowWindow (hWnd, SW_SHOW); |
202 |
UpdateWindow (hWnd); |
UpdateWindow (hWnd); |
206 |
SetActiveWindow (NULL); |
SetActiveWindow (NULL); |
207 |
} |
} |
208 |
|
|
209 |
timer = SetTimer (hWnd, // handle to window |
timer = SetTimer (hWnd, PD_TIMER_IDENTIFIER, millis, |
210 |
PD_TIMER_IDENTIFIER, // timer identifier |
(TIMERPROC) popup_timer_proc); |
|
millis, // time-out value |
|
|
(TIMERPROC) popup_timer_proc // timer procedure |
|
|
); |
|
211 |
|
|
212 |
while (GetMessage (&msg, NULL, 0, 0)) { |
while (GetMessage (&msg, NULL, 0, 0)) { |
213 |
TranslateMessage (&msg); |
TranslateMessage (&msg); |