我们从Python开源项目中,提取了以下44个代码示例,用于说明如何使用win32api.LOWORD。
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)
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
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
def OnCommand(self, hwnd, msg, wparam, lparam): id = win32api.LOWORD(wparam) if id == 1023: print '1023' elif id == 1024: print "????" elif id == 1025: self.netkeeper.disconnect() print "????" elif id == 1026: print "????" settings.RUNNING = False win32gui.DestroyWindow(self.hwnd) else: print "Unknown command -", id
def _get_version_number (filename): from win32api import GetFileVersionInfo, LOWORD, HIWORD try: info = GetFileVersionInfo (filename, "\\") ms = info['FileVersionMS'] ls = info['FileVersionLS'] return HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls) except: return 0,0,0,0
def OnSize(self, hwnd, msg, wparam, lparam): x = win32api.LOWORD(lparam) y = win32api.HIWORD(lparam) self.eb.SetRect(None, (0, 0, x, y))
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.
def OnSize(self, hwnd, msg, wparam, lparam): x = win32api.LOWORD(lparam) y = win32api.HIWORD(lparam) win32gui.MoveWindow(self.hwnd, 0, 0, x, y, False)
def get_version(self): """Return the AIMP version as a tuple containing the major version and the build number, e.g ``('4.12', 1878)``. :rtype: tuple """ version = self._get_prop(AIMP_RA_PROPERTY_VERSION) if not version: return None return ('{:.2f}'.format(win32api.HIWORD(version) / 100), win32api.LOWORD(version))
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
def OnSize(self, hwnd, msg, wparam, lparam): x = win32api.LOWORD(lparam) y = win32api.HIWORD(lparam) self._DoSize(x,y) return 1
def OnCommand(self, hwnd, msg, wparam, lparam): # Needed to make OK/Cancel work - no other controls are handled. id = win32api.LOWORD(wparam) if id in [win32con.IDOK, win32con.IDCANCEL]: win32gui.EndDialog(hwnd, id)
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
def OnSize (self, params): lParam = params[3] self.width = win32api.LOWORD(lParam) self.height = win32api.HIWORD(lParam)
def on_size (self, params): lparam = params[3] w = win32api.LOWORD(lparam) h = win32api.HIWORD(lparam) self.LayoutControls(w, h)
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):
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))
def OnSize (self, params): lParam = params[3] cx = win32api.LOWORD(lParam) cy = win32api.HIWORD(lParam) glViewport(0, 0, cx, cy) if self.oldrect[2] > cx or self.oldrect[3] > cy: self.RedrawWindow() self.OnSizeChange(cx, cy) self.oldrect = self.oldrect[0], self.oldrect[1], cx, cy
def OnActivate(self, msg): wparam = msg[2] fActive = win32api.LOWORD(wparam) if fActive != win32con.WA_INACTIVE: self.CheckButtonStates()
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)
def fileVersion(program=None): ver = '?' if program == None: check = sys.argv[0] else: s = program.rfind('.') if s > 0 and program[s:] == '.html': check = program elif s < len(program) - 4: check = program + sys.argv[0][sys.argv[0].rfind('.'):] else: check = program if check[-3:] == '.py': try: modtime = datetime.fromtimestamp(os.path.getmtime(check)) ver = '1.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day) except: pass elif check[-5:] == '.html': try: modtime = datetime.fromtimestamp(os.path.getmtime(check)) ver = '1.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day) except: pass else: if sys.platform == 'win32' or sys.platform == 'cygwin': try: if check.find('\\') >= 0: # if full path info = GetFileVersionInfo(check, '\\') else: info = GetFileVersionInfo(os.getcwd() + '\\' + check, '\\') ms = info['ProductVersionMS'] # ls = info['FileVersionLS'] ls = info['ProductVersionLS'] ver = str(HIWORD(ms)) + '.' + str(LOWORD(ms)) + '.' + str(HIWORD(ls)) + '.' + str(LOWORD(ls)) except: try: info = os.path.getmtime(os.getcwd() + '\\' + check) ver = '1.0.' + datetime.datetime.fromtimestamp(info).strftime('%Y.%m%d') if ver[9] == '0': ver = ver[:9] + ver[10:] except: pass return ver