MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / WindowProc

Method WindowProc

cppcryptfs/ui/TrayIcon.h:195–231  ·  view source on GitHub ↗

Overrides

Source from the content-addressed store, hash-verified

193
194// Overrides
195 virtual LRESULT WindowProc(UINT Message, WPARAM wParam, LPARAM lParam) {
196 if(Message==NID.uCallbackMessage
197 && wParam==NID.uID) {
198 CMenu Menu, *pSubMenu;
199 CWnd* pMainWnd=AfxGetMainWnd();
200 switch(LOWORD(lParam)) {
201 case WM_RBUTTONUP: { // Clicking with right button brings up a context Menu
202 if(!Menu.LoadMenu(NID.uID)
203 || !(pSubMenu=Menu.GetSubMenu(0))) return false;
204 // Make chosen Menu item the default (bold font)
205 ::SetMenuDefaultItem(pSubMenu->m_hMenu, DefaultMenuItemID, DefaultMenuItemByPos);
206 // Display and track the popup Menu
207 CPoint Mouse;
208 GetCursorPos(&Mouse);
209 pMainWnd->SetForegroundWindow(); // See MSDN Knowledge Base article "PRB: Menus for Notification Icons Don't Work Correctly"
210 pSubMenu->TrackPopupMenu(TPM_LEFTALIGN, Mouse.x, Mouse.y, pMainWnd, 0);
211 pMainWnd->PostMessage(WM_NULL, 0, 0); // See MSDN Knowledge Base article "PRB: Menus for Notification Icons Don't Work Correctly"
212 Menu.DestroyMenu();
213 return true;
214 }
215 case WM_LBUTTONDBLCLK: return DoubleClicked=true; // double click received, do the default Menu item
216 case WM_LBUTTONUP: {
217 if(DoubleClicked) { // Make sure that if the default deletes the icon, that the next icon doesn't get our WM_LBUTTONUP notification (some icons use it).
218 DoubleClicked=false;
219 pMainWnd->SetForegroundWindow();
220 UINT uItem;
221 if(DefaultMenuItemByPos) {
222 if(!Menu.LoadMenu(NID.uID)
223 || !(pSubMenu=Menu.GetSubMenu(0))) return false;
224 uItem=pSubMenu->GetMenuItemID(DefaultMenuItemID);
225 }else uItem=DefaultMenuItemID;
226 pMainWnd->PostMessage(WM_COMMAND, uItem, 0);
227 Menu.DestroyMenu();
228 return true;
229 } } } }
230 return CWnd::WindowProc(Message, wParam, lParam);
231 }
232};
233
234//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> CAniIcon <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected