def OnTaskbarNotify(self, hwnd, msg, wparam, lparam):
if lparam==win32con.WM_RBUTTONUP:
print "You right clicked me."
# display the menu at the cursor pos.
pos = GetCursorPos()
SetForegroundWindow(self.hwnd)
TrackPopupMenu(self.hmenu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None)
PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
elif lparam==win32con.WM_LBUTTONDBLCLK:
print "You double-clicked me"
# find the default menu item and fire it.
cmd = GetMenuDefaultItem(self.hmenu, False, 0)
if cmd == -1:
print "Can't find a default!"
# and just pretend it came from the menu
self.OnCommand(hwnd, win32con.WM_COMMAND, cmd, 0)
return 1
评论列表
文章目录