Click to See Complete Forum and Search --> : Menu


mariela
November 9th, 2003, 05:42 AM
Hi,

When I press on the Icon, I get a Debug Assertion Failed.
I hope that somebody will be able t help me.

Here is the Code:

BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
static UINT s_uTaskbarRestart;

switch (uMsg)
{
case WM_INITDIALOG:

NOTIFYICONDATA ndata;

ndata.cbSize=sizeof(NOTIFYICONDATA);
ndata.hWnd=hwndDlg;
ndata.uID=2000;
ndata.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP;
ndata.uCallbackMessage=WM_ICON_NOTIFY;
ndata.hIcon=(HICON)LoadImage(GetModuleHandle("AppControllerServer.exe"),MAKEINTRESOURCE(IDI_STANDBY),IMAGE_ICON,16,16,LR_SHARED);

strcpy(ndata.szTip,"AppController");
Shell_NotifyIcon(NIM_ADD,&ndata);

SetWindowPos(hwndDlg,NULL,-10,-10,0,0,SWP_NOZORDER|SWP_NOMOVE);

hwnd = hwndDlg;

//Get Message each time we create Task Bar.
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));

break;

case WM_ICON_NOTIFY:
if (lParam==WM_RBUTTONDOWN)
{
Beep(200,200);
CMenu menu;
if(!menu.LoadMenu(IDR_POPUP))
{
return FALSE;
}
CMenu*popup=menu.GetSubMenu(0);
CPoint pt;
GetCursorPos(&pt);
popup->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,CWnd::FromHandle(hwndDlg),CRect(0,0,0,0));
}
break;
case WM_COMMAND:
if (LOWORD(wParam) == ID_POPUP_CLIENT)
AfxMessageBox("Hello Mariel");
break;

default:
if(uMsg == s_uTaskbarRestart)
pAppControllerIcon->SetIconAtSystemTray();
break;


}
return FALSE;
}

Marc G
November 13th, 2003, 05:08 AM
Try to run it in de debugger. The debugger should break on your assertion and then you should be able to figure out where the problem is. Otherwise, post the line where the debugger breaks.