本文整理汇总了Python中win32con.WM_COMMAND属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.WM_COMMAND属性的具体用法?Python win32con.WM_COMMAND怎么用?Python win32con.WM_COMMAND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.WM_COMMAND属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def __init__(self):
msg_TaskbarRestart = win32gui.RegisterWindowMessage("TaskbarCreated");
message_map = {
msg_TaskbarRestart: self.OnRestart,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_USER+20 : self.OnTaskbarNotify,
}
# Register the Window class.
wc = win32gui.WNDCLASS()
hinst = wc.hInstance = win32api.GetModuleHandle(None)
wc.lpszClassName = "PythonTaskbarDemo"
wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
wc.hCursor = win32api.LoadCursor( 0, win32con.IDC_ARROW )
wc.hbrBackground = win32con.COLOR_WINDOW
wc.lpfnWndProc = message_map # could also specify a wndproc.
# Don't blow up if class already registered to make testing easier
try:
classAtom = win32gui.RegisterClass(wc)
except win32gui.error, err_info:
if err_info.winerror!=winerror.ERROR_CLASS_ALREADY_EXISTS:
raise
# Create the Window.
示例2: get_new_desktop_name
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def get_new_desktop_name(parent_hwnd):
""" Create a dialog box to ask the user for name of desktop to be created """
msgs={win32con.WM_COMMAND:desktop_name_dlgproc,
win32con.WM_CLOSE:desktop_name_dlgproc,
win32con.WM_DESTROY:desktop_name_dlgproc}
# dlg item [type, caption, id, (x,y,cx,cy), style, ex style
style=win32con.WS_BORDER|win32con.WS_VISIBLE|win32con.WS_CAPTION|win32con.WS_SYSMENU ## |win32con.DS_SYSMODAL
h=win32gui.CreateDialogIndirect(
win32api.GetModuleHandle(None),
[['One ugly dialog box !',(100,100,200,100),style,0],
['Button','Create', win32con.IDOK, (10,10,30,20),win32con.WS_VISIBLE|win32con.WS_TABSTOP|win32con.BS_HOLLOW|win32con.BS_DEFPUSHBUTTON],
['Button','Never mind', win32con.IDCANCEL, (45,10,50,20),win32con.WS_VISIBLE|win32con.WS_TABSTOP|win32con.BS_HOLLOW],
['Static','Desktop name:',71,(10,40,70,10),win32con.WS_VISIBLE],
['Edit','',72,(75,40,90,10),win32con.WS_VISIBLE]],
parent_hwnd, msgs) ## parent_hwnd, msgs)
win32gui.EnableWindow(h,True)
hcontrol=win32gui.GetDlgItem(h,72)
win32gui.EnableWindow(hcontrol,True)
win32gui.SetFocus(hcontrol)
示例3: initialize
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def initialize(klass):
WM_RESTART = win32gui.RegisterWindowMessage('TaskbarCreated')
klass.WM_NOTIFY = win32con.WM_USER+1
klass.WNDCLASS = win32gui.WNDCLASS()
klass.WNDCLASS.hInstance = win32gui.GetModuleHandle(None)
klass.WNDCLASS.lpszClassName = 'Py_'+klass.__name__
klass.WNDCLASS.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
klass.WNDCLASS.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
klass.WNDCLASS.hIcon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
klass.WNDCLASS.hbrBackground = win32con.COLOR_WINDOW
klass.WNDCLASS.lpfnWndProc = {
WM_RESTART: klass._restart,
klass.WM_NOTIFY: klass._notify,
win32con.WM_CLOSE: klass._close,
win32con.WM_DESTROY: klass._destroy,
win32con.WM_COMMAND: klass._command,
}
klass.CLASS_ATOM = win32gui.RegisterClass(klass.WNDCLASS)
klass._instance = {}
return
示例4: _notify
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _notify(klass, hwnd, msg, wparam, lparam):
self = klass._instance[hwnd]
if lparam == win32con.WM_LBUTTONDBLCLK:
menu = self.get_popup()
wid = win32gui.GetMenuDefaultItem(menu, 0, 0)
if 0 < wid:
win32gui.PostMessage(hwnd, win32con.WM_COMMAND, wid, 0)
elif lparam == win32con.WM_RBUTTONUP:
menu = self.get_popup()
pos = win32gui.GetCursorPos()
win32gui.SetForegroundWindow(hwnd)
win32gui.TrackPopupMenu(
menu, win32con.TPM_LEFTALIGN,
pos[0], pos[1], 0, hwnd, None)
win32gui.PostMessage(hwnd, win32con.WM_NULL, 0, 0)
elif lparam == win32con.WM_LBUTTONUP:
pass
return True
示例5: __call__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def __call__(self, *args):
win32ui.GetMainFrame().SendMessage(win32con.WM_COMMAND, self.cmd)
示例6: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_SIZE: self.OnSize,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_NOTIFY: self.OnNotify,
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
WM_SEARCH_RESULT: self.OnSearchResult,
WM_SEARCH_FINISHED: self.OnSearchFinished,
}
dlgClassName = self._RegisterWndClass()
template = self._GetDialogTemplate(dlgClassName)
return fn(self.hinst, template, 0, message_map)
示例7: desktop_name_dlgproc
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def desktop_name_dlgproc(hwnd,msg,wparam,lparam):
""" Handles messages from the desktop name dialog box """
if msg in (win32con.WM_CLOSE,win32con.WM_DESTROY):
win32gui.DestroyWindow(hwnd)
elif msg == win32con.WM_COMMAND:
if wparam == win32con.IDOK:
desktop_name=win32gui.GetDlgItemText(hwnd, 72)
print 'new desktop name: ',desktop_name
win32gui.DestroyWindow(hwnd)
create_desktop(desktop_name)
elif wparam == win32con.IDCANCEL:
win32gui.DestroyWindow(hwnd)
示例8: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
}
return fn(0, self.dlg_template, 0, message_map)
示例9: _sendNotifyMessage
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _sendNotifyMessage(hwnd, nofifyMessage):
'''Send a notify message to a control.'''
win32gui.SendMessage(win32gui.GetParent(hwnd),
win32con.WM_COMMAND,
_buildWinLong(nofifyMessage,
win32api.GetWindowLong(hwnd,
win32con.GWL_ID)),
hwnd)
示例10: _sendNotifyMessage
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _sendNotifyMessage(hwnd, nofifyMessage):
"""Send a notify message to a control."""
win32gui.SendMessage(win32gui.GetParent(hwnd),
win32con.WM_COMMAND,
_buildWinLong(nofifyMessage,
win32api.GetWindowLong(hwnd,
win32con.GWL_ID)),
hwnd)
示例11: default_message_map
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def default_message_map(self):
message_map = {
win32con.WM_COMMAND: self._on_command,
win32con.WM_DESTROY: self._on_destroy,
}
return message_map
示例12: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_SIZE: self.OnSize,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_NOTIFY: self.OnNotify,
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
}
dlgClassName = self._RegisterWndClass()
template = self._GetDialogTemplate(dlgClassName)
return fn(self.hinst, template, 0, message_map)
示例13: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def __init__(self):
super(Shell, self).__init__()
msg_taskbar_restart = win32gui.RegisterWindowMessage("TaskbarCreated")
self.message_map = {msg_taskbar_restart: self.OnRestart,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_USER + 20: self.OnTaskbarNotify, }
self.main_frame = MainFrame(self.message_map)
self.status_icon = StatusIcon(self)
self.notice_index = -1 # rolling index of topmost notice in the queue
self.console = None
self.destroyed = False
示例14: __call__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_COMMAND [as 别名]
def __call__(self):
return SendCommand(WM_COMMAND, IDM_CHANNELPLUS)