void CMainFrame::addIconToTray()
{
BOOL lRet = FALSE;
NOTIFYICONDATA lIcon;
ZeroMemory( &lIcon, sizeof lIcon );
lIcon.cbSize = sizeof NOTIFYICONDATA;
lIcon.hIcon = m_hIcon;
lIcon.uFlags = NIF_ICON;
lIcon.hWnd = m_hWnd;
lIcon.uID = (UINT) this;
if( Shell_NotifyIcon(NIM_ADD,&lIcon) )
{
lIcon.uVersion = NOTIFYICON_VERSION;
lRet = Shell_NotifyIcon(NIM_SETVERSION,&lIcon);
lIcon.uFlags = NIF_TIP;
StringCchCopy(lIcon.szTip, ARRAYSIZE(lIcon.szTip), mpBallonTitle);
lRet = Shell_NotifyIcon(NIM_MODIFY, &lIcon);
lIcon.uFlags = NIF_MESSAGE;
m_hCallbackMsg = RegisterWindowMessage(mpBallonTitle);
lIcon.uCallbackMessage = (UINT) m_hCallbackMsg;
lRet = Shell_NotifyIcon(NIM_MODIFY, &lIcon);
}
}
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if( message == m_hCallbackMsg )
{
switch( lParam )
{
case WM_LBUTTONDBLCLK:
PostMessage(WM_COMMAND,MAKELONG(IDM_KOMBI_PROP,0),0);
return 0;
...
ON_COMMAND(IDM_KOMBI_PROP, OnKombiProp)
void CMainFrame::OnKombiProp()
{
ShowWindow( SW_SHOW );
}