Python win32api.LOWORD Examples

The following are 30 code examples of win32api.LOWORD(). 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 win32api , or try the search function .
Example #1
Source File: win32gui_dialog.py    From ironpython2 with Apache License 2.0 9 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        id = win32api.LOWORD(wparam)
        if id == IDC_BUTTON_SEARCH:
            self.ClearListItems()
            def fill_slowly(q, hwnd):
                import time
                for i in range(20):
                    q.put(("whatever", str(i+1), "Search result " + str(i) ))
                    win32gui.PostMessage(hwnd, WM_SEARCH_RESULT, 0, 0)
                    time.sleep(.25)
                win32gui.PostMessage(hwnd, WM_SEARCH_FINISHED, 0, 0)

            import threading
            self.result_queue = Queue.Queue()
            thread = threading.Thread(target = fill_slowly, args=(self.result_queue, self.hwnd) )
            thread.start()
        elif id == IDC_BUTTON_DISPLAY:
            print "Display button selected"
            sel = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED)
            print "The selected item is", sel+1

    # These function differ based on how the window is used, so may be overridden 
Example #2
Source File: windows.py    From cloudbase-init with Apache License 2.0 9 votes vote down vote up
def get_file_version(self, path):
        info = win32api.GetFileVersionInfo(path, '\\')
        ms = info['FileVersionMS']
        ls = info['FileVersionLS']
        return (win32api.HIWORD(ms), win32api.LOWORD(ms),
                win32api.HIWORD(ls), win32api.LOWORD(ls)) 
Example #3
Source File: taskbar_widget.py    From termite-visualizations with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def OnCommand(
        self,
        hwnd,
        msg,
        wparam,
        lparam,
    ):
        id = win32api.LOWORD(wparam)
        if id == 1023:
            self.status.append(self.EnumStatus.TOGGLE)
        elif id == 1024:
            self.status.append(self.EnumStatus.START)
        elif id == 1025:
            self.status.append(self.EnumStatus.RESTART)
        elif id == 1026:
            self.status.append(self.EnumStatus.STOP)
        elif id == 1027:
            self.status.append(self.EnumStatus.QUIT)
            self.Destroy()
        else:
            print 'Unknown command -', id 
Example #4
Source File: shell_view.py    From Email_My_PC with MIT License 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        win32gui.MoveWindow(self.hwnd, 0, 0, x, y, False) 
Example #5
Source File: explorer_browser.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        self.eb.SetRect(None, (0, 0, x, y)) 
Example #6
Source File: shell_view.py    From Email_My_PC with MIT License 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        #print "OnSize", self.hwnd_child, win32api.LOWORD(lparam), win32api.HIWORD(lparam)
        if self.hwnd_child is not None:
            x = win32api.LOWORD(lparam)
            y = win32api.HIWORD(lparam)
            win32gui.MoveWindow(self.hwnd_child, 0, 0, x, y, False)

# This uses scintilla to display a filename, and optionally jump to a line
# number. 
Example #7
Source File: explorer_browser.py    From Email_My_PC with MIT License 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        self.eb.SetRect(None, (0, 0, x, y)) 
Example #8
Source File: simpledialog.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        id = win32api.LOWORD(wparam)
        if id == IDC_BUTTON_CANCEL:
            print("Cancel button pressed.")
            win32gui.EndDialog(hwnd, 0)
        elif id == IDC_BUTTON_OK:
            print("Ok button pressed")
            self.value = win32gui.GetDlgItemText(self.hwnd, IDC_SEARCHTEXT)
            print(self.value)
            win32gui.EndDialog(hwnd, 1) 
Example #9
Source File: notice_dlg.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        id = win32api.LOWORD(wparam)
        if id == IDC_BUTTON_CLOSE:
            self.on_close_btn_clicked()
        elif id == IDC_BUTTON_SUBMIT:
            self.on_submit_btn_clicked()
        elif id == IDC_BUTTON_CLEAR:
            self.on_clear_btn_clicked() 
Example #10
Source File: notice_dlg.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        self._DoSize(x, y)
        return 1 
Example #11
Source File: console.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        id = win32api.LOWORD(wparam)

        if id == IDC_BUTTON_CLOSE:
            self.on_close_btn_clicked()
        elif id == IDC_BUTTON_SUBMIT:
            self.on_submit_btn_clicked()
        elif id == IDC_BUTTON_CLEAR:
            self.on_clear_btn_clicked() 
Example #12
Source File: console.py    From eavatar-me with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        self._DoSize(x, y)
        return 1 
Example #13
Source File: tray.py    From MouseTracks with GNU General Public License v3.0 5 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        """Run functions from ID."""
        id = win32api.LOWORD(wparam)
        
        #Handle case when action isn't set
        try:
            action, args, kwargs = self.menu_actions_by_id[id]
            self.logger.info('Function "%s" was called.', action.__name__)
        except KeyError:
            pass
        else:
            action(self, *args, **kwargs) 
Example #14
Source File: dialog_base.py    From dragonfly with GNU Lesser General Public License v3.0 5 votes vote down vote up
def on_size(self, hwnd, msg, wparam, lparam):
        width  = win32api.LOWORD(lparam)
        height = win32api.HIWORD(lparam)
        self._do_size(width, height)
        return 1 
Example #15
Source File: dialog_base.py    From dragonfly with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _dialog_build_message_map(self):
        # Collect all controls which expect callbacks.
        map = {}
        for control in self._dialog_controls:
            for message, callback in control.message_callbacks.items():
                map.setdefault(message, {})[control.id] = callback

        # Create dispatchers for each type of message.
        for message, control_callbacks in map.items():
            def dispatcher(hwnd, msg, wparam, lparam):
                id = win32api.LOWORD(wparam)
                if id in control_callbacks:
                    control_callbacks[id](hwnd, msg, wparam, lparam)
            map[message] = dispatcher

        # Add the top-level callbacks handled by the window itself.
        map.update({
                    win32con.WM_SIZE:           self.on_size,
                    win32con.WM_INITDIALOG:     self.on_init_dialog,
                    win32con.WM_GETMINMAXINFO:  self.on_getminmaxinfo,
                    win32con.WM_CLOSE:          self.on_close,
                    win32con.WM_DESTROY:        self.on_destroy,
                  })
        return map


    #-----------------------------------------------------------------------
    # Message handler methods. 
Example #16
Source File: win32gui_taskbar.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnCommand(self, hwnd, msg, wparam, lparam):
        id = win32api.LOWORD(wparam)
        if id == 1023:
            import win32gui_dialog
            win32gui_dialog.DemoModal()
        elif id == 1024:
            print "Hello"
        elif id == 1025:
            print "Goodbye"
            win32gui.DestroyWindow(self.hwnd)
        else:
            print "Unknown command -", id 
Example #17
Source File: win32gui_dialog.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        self._DoSize(x,y)
        return 1 
Example #18
Source File: ModuleBrowser.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize(self, params):
        lparam = params[3]
        w = win32api.LOWORD(lparam)
        h = win32api.HIWORD(lparam)
        if w != 0:
            self.CheckMadeList()
        elif w == 0:
            self.DestroyList()
        return 1 
Example #19
Source File: bitmap.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize (self, params):
		lParam = params[3]
		self.width = win32api.LOWORD(lParam)
		self.height = win32api.HIWORD(lParam) 
Example #20
Source File: browser.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def on_size (self, params):
        lparam = params[3]
        w = win32api.LOWORD(lparam)
        h = win32api.HIWORD(lparam)
        self.GetDlgItem (win32ui.IDC_LIST1).MoveWindow((0,0,w,h)) 
Example #21
Source File: list.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def on_size (self, params):
		lparam = params[3]
		w = win32api.LOWORD(lparam)
		h = win32api.HIWORD(lparam)
		self.LayoutControls(w, h) 
Example #22
Source File: find.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnActivate(self, msg):
		wparam = msg[2]
		fActive = win32api.LOWORD(wparam)
		if fActive != win32con.WA_INACTIVE:
			self.CheckButtonStates() 
Example #23
Source File: dibdemo.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize (self, params):
		lParam = params[3]
		self.width = win32api.LOWORD(lParam)
		self.height = win32api.HIWORD(lParam) 
Example #24
Source File: threadedgui.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize (self, params):
		lParam = params[3]
		self.width = win32api.LOWORD(lParam)
		self.height = win32api.HIWORD(lParam) 
Example #25
Source File: fontdemo.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize (self, params):
		lParam = params[3]
		self.width = win32api.LOWORD(lParam)
		self.height = win32api.HIWORD(lParam) 
Example #26
Source File: DockingBar.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnMouseMove(self, msg):
		flags = wparam = msg[2]
		lparam = msg[3]
		if self.IsFloating() or not self.bTracking:
			return 1

		# Convert unsigned 16 bit to signed 32 bit.
		x=win32api.LOWORD(lparam)
		if x & 32768: x = x | -65536
		y = win32api.HIWORD(lparam)
		if y & 32768: y = y | -65536
		pt = x, y
		cpt = CenterPoint(self.rectTracker)
		pt = self.ClientToWnd(pt)
		if self.IsHorz():
			if cpt[1] != pt[1]:
				self.OnInvertTracker(self.rectTracker)
				self.rectTracker = OffsetRect(self.rectTracker, (0, pt[1] - cpt[1]))
				self.OnInvertTracker(self.rectTracker)
		else:
			if cpt[0] != pt[0]:
				self.OnInvertTracker(self.rectTracker)
				self.rectTracker = OffsetRect(self.rectTracker, (pt[0]-cpt[0], 0))
				self.OnInvertTracker(self.rectTracker)

		return 0 # Dont pass it on.

#	def OnBarStyleChange(self, old, new): 
Example #27
Source File: shell_view.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        x = win32api.LOWORD(lparam)
        y = win32api.HIWORD(lparam)
        win32gui.MoveWindow(self.hwnd, 0, 0, x, y, False) 
Example #28
Source File: shell_view.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnSize(self, hwnd, msg, wparam, lparam):
        #print "OnSize", self.hwnd_child, win32api.LOWORD(lparam), win32api.HIWORD(lparam)
        if self.hwnd_child is not None:
            x = win32api.LOWORD(lparam)
            y = win32api.HIWORD(lparam)
            win32gui.MoveWindow(self.hwnd_child, 0, 0, x, y, False)

# This uses scintilla to display a filename, and optionally jump to a line
# number. 
Example #29
Source File: NativeEvent.py    From PyQt with GNU General Public License v3.0 4 votes vote down vote up
def nativeEvent(self, eventType, message):
        retval, result = super(Window, self).nativeEvent(eventType, message)
        if eventType == "windows_generic_MSG":
            msg = ctypes.wintypes.MSG.from_address(message.__int__())
            # 获取鼠标移动经过时的坐标
            x = win32api.LOWORD(msg.lParam) - self.frameGeometry().x()
            y = win32api.HIWORD(msg.lParam) - self.frameGeometry().y()
            # 判断鼠标位置是否有其它控件
            if self.childAt(x, y) != None:
                return retval, result
            if msg.message == win32con.WM_NCCALCSIZE:
                # 拦截不显示顶部的系统自带的边框
                return True, 0
            if msg.message == win32con.WM_GETMINMAXINFO:
                # 当窗口位置改变或者大小改变时会触发该消息
                info = ctypes.cast(
                    msg.lParam, ctypes.POINTER(MINMAXINFO)).contents
                # 修改最大化的窗口大小为主屏幕的可用大小
                info.ptMaxSize.x = self._rect.width()
                info.ptMaxSize.y = self._rect.height()
                # 修改放置点的x,y坐标为0,0
                info.ptMaxPosition.x, info.ptMaxPosition.y = 0, 0
            if msg.message == win32con.WM_NCHITTEST:
                w, h = self.width(), self.height()
                lx = x < self.BorderWidth
                rx = x > w - self.BorderWidth
                ty = y < self.BorderWidth
                by = y > h - self.BorderWidth
                # 左上角
                if (lx and ty):
                    return True, win32con.HTTOPLEFT
                # 右下角
                if (rx and by):
                    return True, win32con.HTBOTTOMRIGHT
                # 右上角
                if (rx and ty):
                    return True, win32con.HTTOPRIGHT
                # 左下角
                if (lx and by):
                    return True, win32con.HTBOTTOMLEFT
                # 上
                if ty:
                    return True, win32con.HTTOP
                # 下
                if by:
                    return True, win32con.HTBOTTOM
                # 左
                if lx:
                    return True, win32con.HTLEFT
                # 右
                if rx:
                    return True, win32con.HTRIGHT
                # 标题
                return True, win32con.HTCAPTION
        return retval, result 
Example #30
Source File: console.py    From eavatar-me with Apache License 2.0 3 votes vote down vote up
def _show_caret_pos(self):
        edit = win32gui.GetDlgItem(self.hwnd, IDC_SCRIPT)
        pos = win32gui.SendMessage(edit, win32con.EM_GETSEL, None, None)
        self.row = win32api.LOWORD(pos)
        self.col = win32api.HIWORD(pos)
        self._set_status_message('%d:%d' % (self.row, self.col))