c++ - No events from notify icon -
my application running in background shows it's activity via notification icon in scheme tray. wanted add together popup-menu notification icon. unfortunately not receive events it. that's i'm doing create icon , event handler:
first create invisible window utilize it's event handler
zeromemory(&wc,sizeof(wndclassex)); wc.cbsize=sizeof(wndclassex); wc.lpfnwndproc=wndproc; wc.hinstance=hinstance; wc.lpszclassname=l"mycl"; registerclassex(&wc); hwnd=createwindowex(ws_ex_clientedge,l"mycl",l"mywn",ws_overlappedwindow,cw_usedefault, cw_usedefault,1,1,null,null,hinstance,null);
next create , show icon itself:
zeromemory(&nidata,sizeof(notifyicondata)); nidata.cbsize=sizeof(notifyicondata); nidata.uid=idi_aaaa; // icon's identifier nidata.uflags=nif_icon|nif_message|nif_tip; nidata.hicon=(hicon)loadimage(hinstance,makeintresource(idi_aaaa),image_icon, getsystemmetrics(sm_cxsmicon),getsystemmetrics(sm_cysmicon), lr_defaultcolor); nidata.hwnd=hwnd; nidata.ucallbackmessage=my_tray_icon_message; shell_notifyicon(nim_add,&nidata);
and event handler assigned invisible window , have assumed events icon should arrive too:
lresult callback wndproc(hwnd hwnd,uint msg,wparam wparam,lparam lparam) { switch(msg) { case wm_close: destroywindow(hwnd); break; case wm_destroy: postquitmessage(0); break; case my_tray_icon_message: // should related notification icon never called switch (lparam) { case wm_lbuttondown: case wm_rbuttondown: case wm_contextmenu: break; } break; default: homecoming defwindowproc(hwnd,msg,wparam,lparam); } homecoming 0; }
anybody thought wrong here?
c++ windows winapi events messages
No comments:
Post a Comment