Originally posted by Dave Biggs
View Post
Jochen
#define IDM_SETZONE somenumericvalue #define IDM_SETIME somenumericvalue ..... POPUPMENU MENU .....
Global pMenu as long 'PopupMenu global mMenu as long 'Main Menu In your Dialog Procedure: Callback Function DialogProc() as long Static ti As NOTIFYICONDATA Local wMsg As Long Local wParam As Long Local lParam As Long wMsg = CbMsg lParam = CbLparam wparam = CbWparam hInst = hInstance BEGIN: Select Case wMsg Case %WM_INITDIALOG 'Set the timer for the clock If IsTrue AutoCheck Then SetTimer hDlg, %IDT_TIMER2, 2000, ByVal %NULL ' ** Add tray icon ti.cbSize = SizeOf(ti) ti.hWnd = hDlg ti.uID = hInst ti.uFlags = %NIF_ICON Or %NIF_MESSAGE Or %NIF_TIP ti.uCallbackMessage = %WM_TRAYICON ti.hIcon = LoadIcon(hInst, ByVal %ATOM1) ti.szTip = Mine Shell_NotifyIcon %NIM_ADD, ti DestroyIcon ti.hIcon ' ** Get Menu Handle pMenu = GetSubMenu(LoadMenu(hInstance, "POPUPMENU"), 0) Case %WM_COMMAND Select Case LoWrd(wParam) Case %IDM_ACHECK 'Normal Menu Stuff Case %IDM_OPTIONS End Select Case %WM_TRAYICON Select Case LoWrd(lParam) ' ** Left button press Case %WM_LBUTTONDOWN If IsWindowVisible(hDlg) = %TRUE Then SetFocus hDlg Case %WM_LBUTTONDBLCLK If IsWindowVisible(hDlg) = %FALSE Then ShowWindow hDlg, %SW_SHOW Or %SW_SHOWNORMAL Else SetFocus hDlg ' ** Right button press Case %WM_RBUTTONDOWN SetForegroundWindow hDlg GetCursorPos p TrackPopupMenu pMenu, 0, p.x, p.y, 0, hDlg, ByVal %NULL Postmessage hDlg, %WM_NULL, 0, 0 End Select End Select Now, I have this set so that when WM_CLOSE occurs, it goes BACK to the system tray and does not close... My resource file, especially for the tray menu: POPUPMENU Menu BEGIN Popup "&Tray" BEGIN MENUITEM "&Options" IDM_OPTIONS MENUITEM "&Always On Top" IDM_ONTOP MENUITEM "&Check Time" IDM_ACHECK MENUITEM "&Help", IDM_HELP MENUITEM "&About", IDM_ABOUT MENUITEM SEPARATOR MENUITEM "Exit", IDM_EXIT End End
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: