Python win32con.WM_COMMAND Examples

The following are 30 code examples of win32con.WM_COMMAND(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module win32con , or try the search function .
Example #1
Source File: win32gui_taskbar.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
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. 
Example #2
Source File: __init__.py    From pyrexecd with MIT License 6 votes vote down vote up
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 
Example #3
Source File: __init__.py    From pyrexecd with MIT License 6 votes vote down vote up
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 
Example #4
Source File: desktopmanager.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
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) 
Example #5
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SETTINGS_PIXELWIDTH_720) 
Example #6
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_ASPECT_ANAMORPHIC) 
Example #7
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_COLOR_PLUS) 
Example #8
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_COLOR_MINUS) 
Example #9
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_COLOR_CURRENT) 
Example #10
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_BRIGHTNESS_PLUS) 
Example #11
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SETTINGS_PIXELWIDTH_320) 
Example #12
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_TAKECONSECUTIVESTILL) 
Example #13
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SETTINGS_PIXELWIDTH_640) 
Example #14
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SETTINGS_PIXELWIDTH_480) 
Example #15
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SETTINGS_PIXELWIDTH_384) 
Example #16
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_ON_TOP)

# ######### Recording Stuff  ############################ 
Example #17
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_TSSTOP) 
Example #18
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_ASPECT_LETTERBOX) 
Example #19
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_CAPTURE_PAUSE) 
Example #20
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SOURCE_INPUT2) 
Example #21
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_TAKECYCLICSTILL) 
Example #22
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_TAKESTREAMSNAP) 
Example #23
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_OVERLAY_START) 
Example #24
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_OVERLAY_STOP) 
Example #25
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_SHOW_OSD)


# ######### Video Stuff  ############################ 
Example #26
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_HIDE_OSD) 
Example #27
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_DISPLAY_EPG_EARLIER)


# ######### OSD Stuff  ############################ 
Example #28
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_DISPLAY_EPG_NEXT_IN_PAGE) 
Example #29
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_DISPLAY_EPG_NEXT) 
Example #30
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __call__(self):
        return SendCommand(WM_COMMAND, IDM_DISPLAY_EPG_NOW)