Python win32api 模块,HIWORD 实例源码
我们从Python开源项目中,提取了以下30个代码示例,用于说明如何使用win32api.HIWORD。
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 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 OnSize(self, hwnd, msg, wparam, lparam):
x = win32api.LOWORD(lparam)
y = win32api.HIWORD(lparam)
self._DoSize(x,y)
return 1
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 on_size (self, params):
lparam = params[3]
w = win32api.LOWORD(lparam)
h = win32api.HIWORD(lparam)
self.LayoutControls(w, h)
def OnSize (self, params):
lParam = params[3]
self.width = win32api.LOWORD(lParam)
self.height = win32api.HIWORD(lParam)
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 OnSize (self, params):
lParam = params[3]
self.width = win32api.LOWORD(lParam)
self.height = win32api.HIWORD(lParam)
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.GetDlgItem (win32ui.IDC_LIST1).MoveWindow((0,0,w,h))
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, 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 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 OnSize (self, params):
lParam = params[3]
self.width = win32api.LOWORD(lParam)
self.height = win32api.HIWORD(lParam)
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 OnSize (self, params):
lParam = params[3]
self.width = win32api.LOWORD(lParam)
self.height = win32api.HIWORD(lParam)
def OnSize (self, params):
lParam = params[3]
self.width = win32api.LOWORD(lParam)
self.height = win32api.HIWORD(lParam)
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, hwnd, msg, wparam, lparam):
x = win32api.LOWORD(lparam)
y = win32api.HIWORD(lparam)
self._DoSize(x,y)
return 1
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