Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

systray callback

Status
Not open for further replies.

ForeverCode

Programmer
Dec 6, 2002
41
0
0
US
I'm having issues getting the callback to work for my systray icon. I'm using PreTranslateMessage(MSG* pMsg) to get all the messages in the main dialog. This is what I'm using to make the icon go:
NOTIFYICONDATA XAIMIcon;
HINSTANCE hInst;

hInst = (HINSTANCE)GetWindowLong(m_hWnd,GWL_HINSTANCE);

XAIMIcon.cbSize = sizeof(NOTIFYICONDATA);
XAIMIcon.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDR_MAINFRAME));
XAIMIcon.hWnd = m_hWnd;
strcpy(XAIMIcon.szTip, "XAIM");
XAIMIcon.uCallbackMessage = WM_APP + 17;
XAIMIcon.uID = IDR_MAINFRAME;
XAIMIcon.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
Shell_NotifyIcon(NIM_ADD, &XAIMIcon);

All the examples I can find use CALLBACK WndProc(), but I dont think I can do that in my multiple dialog MFC app. All, I'm trying to do is get the RBUTTONDOWN event. I've tried just about everything to get the callback but can't get it to work, any ideas?
 
Never mind, I got it(stupid me). Just add the virtual funtion WindowProc();
LRESULT Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)

The callback goes there...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top