本文整理汇总了Python中win32gui.SetWindowLong方法的典型用法代码示例。如果您正苦于以下问题:Python win32gui.SetWindowLong方法的具体用法?Python win32gui.SetWindowLong怎么用?Python win32gui.SetWindowLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32gui
的用法示例。
在下文中一共展示了win32gui.SetWindowLong方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def __init__(self, gtk_window):
self._window = gtk_window
self._hwnd = gtk_window.window.handle
self._message_map = {}
# Windows transparency is only supported windows2000 and above.
if sys.getwindowsversion()[0] <= 4:
self.alpha = None
else:
self.alpha = 100
self._transparency = False
self.notify_icon = None
# Sublass the window and inject a WNDPROC to process messages.
self._oldwndproc = win32gui.SetWindowLong(self._hwnd, GWL_WNDPROC,
self._wndproc)
gtk_window.connect('unrealize', self.remove)
示例2: set_alpha
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def set_alpha(self, alpha=100, colorkey=0, mask=False):
""" Sets the transparency of the window. """
if self.alpha != None:
if not self._transparency:
style = win32gui.GetWindowLong(self._hwnd, GWL_EXSTYLE)
if (style & WS_EX_LAYERED) != WS_EX_LAYERED:
style = style | WS_EX_LAYERED
win32gui.SetWindowLong(self._hwnd, GWL_EXSTYLE, style)
self._transparency = True
if mask and colorkey:
flags = LWA_COLORKEY
else:
flags = LWA_ALPHA
if colorkey:
flags = flags | LWA_COLORKEY
win_alpha = int(float(alpha)/100*255)
winxpgui.SetLayeredWindowAttributes(self._hwnd, colorkey,
win_alpha, flags)
self.alpha = int(alpha)
示例3: OnPaint_1
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def OnPaint_1(hwnd, msg, wp, lp):
dc, ps=win32gui.BeginPaint(hwnd)
win32gui.SetGraphicsMode(dc, win32con.GM_ADVANCED)
br=win32gui.CreateSolidBrush(win32api.RGB(255,0,0))
win32gui.SelectObject(dc, br)
angle=win32gui.GetWindowLong(hwnd, win32con.GWL_USERDATA)
win32gui.SetWindowLong(hwnd, win32con.GWL_USERDATA, angle+2)
r_angle=angle*(math.pi/180)
win32gui.SetWorldTransform(dc,
{'M11':math.cos(r_angle), 'M12':math.sin(r_angle), 'M21':math.sin(r_angle)*-1, 'M22':math.cos(r_angle),'Dx':250,'Dy':250})
win32gui.MoveToEx(dc,250,250)
win32gui.BeginPath(dc)
win32gui.Pie(dc, 10, 70, 200, 200, 350, 350, 75, 10)
win32gui.Chord(dc, 200, 200, 850, 0, 350, 350, 75, 10)
win32gui.LineTo(dc, 300,300)
win32gui.LineTo(dc, 100, 20)
win32gui.LineTo(dc, 20, 100)
win32gui.LineTo(dc, 400, 0)
win32gui.LineTo(dc, 0, 400)
win32gui.EndPath(dc)
win32gui.StrokeAndFillPath(dc)
win32gui.EndPaint(hwnd, ps)
return 0
示例4: TestGradientFill
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def TestGradientFill():
wc = win32gui.WNDCLASS()
wc.lpszClassName = 'test_win32gui_2'
wc.style = win32con.CS_GLOBALCLASS|win32con.CS_VREDRAW | win32con.CS_HREDRAW
wc.hbrBackground = win32con.COLOR_WINDOW+1
wc.lpfnWndProc=wndproc_2
class_atom=win32gui.RegisterClass(wc)
hwnd = win32gui.CreateWindowEx(0, class_atom,'Kaleidoscope',
win32con.WS_CAPTION|win32con.WS_VISIBLE|win32con.WS_THICKFRAME|win32con.WS_SYSMENU,
100,100,900,900, 0, 0, 0, None)
s=win32gui.GetWindowLong(hwnd,win32con.GWL_EXSTYLE)
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, s|win32con.WS_EX_LAYERED)
win32gui.SetLayeredWindowAttributes(hwnd, 0, 175, win32con.LWA_ALPHA)
for x in xrange(30):
win32gui.InvalidateRect(hwnd,None,True)
win32gui.PumpWaitingMessages()
time.sleep(0.3)
win32gui.DestroyWindow(hwnd)
win32gui.UnregisterClass(class_atom,None)
示例5: __init__
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
# 主屏幕的可用大小(去掉任务栏)
self._rect = QApplication.instance().desktop().availableGeometry(self)
self.resize(800, 600)
self.setWindowFlags(Qt.Window
| Qt.FramelessWindowHint
| Qt.WindowSystemMenuHint
| Qt.WindowMinimizeButtonHint
| Qt.WindowMaximizeButtonHint
| Qt.WindowCloseButtonHint)
# 增加薄边框
style = win32gui.GetWindowLong(int(self.winId()), win32con.GWL_STYLE)
win32gui.SetWindowLong(
int(self.winId()), win32con.GWL_STYLE, style | win32con.WS_THICKFRAME)
if QtWin.isCompositionEnabled():
# 加上 Aero 边框阴影
QtWin.extendFrameIntoClientArea(self, -1, -1, -1, -1)
else:
QtWin.resetExtendedFrame(self)
示例6: CreateViewWindow
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def CreateViewWindow(self, prev, settings, browser, rect):
print "ScintillaShellView.CreateViewWindow", prev, settings, browser, rect
# Make sure scintilla.dll is loaded. If not, find it on sys.path
# (which it generally is for Pythonwin)
try:
win32api.GetModuleHandle("Scintilla.dll")
except win32api.error:
for p in sys.path:
fname = os.path.join(p, "Scintilla.dll")
if not os.path.isfile(fname):
fname = os.path.join(p, "Build", "Scintilla.dll")
if os.path.isfile(fname):
win32api.LoadLibrary(fname)
break
else:
raise RuntimeError("Can't find scintilla!")
style = win32con.WS_CHILD | win32con.WS_VSCROLL | \
win32con.WS_HSCROLL | win32con.WS_CLIPCHILDREN | \
win32con.WS_VISIBLE
self.hwnd = win32gui.CreateWindow("Scintilla", "Scintilla", style,
rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1],
self.hwnd_parent, 1000, 0, None)
message_map = {
win32con.WM_SIZE: self.OnSize,
}
# win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, message_map)
file_data = file(self.filename, "U").read()
self._SetupLexer()
self._SendSci(scintillacon.SCI_ADDTEXT, len(file_data), file_data)
if self.lineno != None:
self._SendSci(scintillacon.SCI_GOTOLINE, self.lineno)
print "Scintilla's hwnd is", self.hwnd
示例7: hide
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def hide(self, new=True):
"""Hide a window from the task bar.
Kept the old way just to be on the safe side.
"""
if new:
win32gui.ShowWindow(self.hwnd, False)
else:
self.minimise()
win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE)
win32gui.SetWindowLong(self.hwnd, win32con.GWL_EXSTYLE,
win32gui.GetWindowLong(self.hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_TOOLWINDOW)
win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW)
示例8: restore
# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import SetWindowLong [as 别名]
def restore(self):
"""归还窗口"""
# 有bug,归还后窗口没有了WS_VISIBLE样式,不可见
widget = self.layout().itemAt(3).widget()
print('restore', widget.hwnd, widget.style, widget.exstyle)
win32gui.SetParent(widget.hwnd, widget.phwnd) # 让它返回它的父窗口
win32gui.SetWindowLong(
widget.hwnd, win32con.GWL_STYLE, widget.style | win32con.WS_VISIBLE) # 恢复样式
win32gui.SetWindowLong(
widget.hwnd, win32con.GWL_EXSTYLE, widget.exstyle) # 恢复样式
win32gui.ShowWindow(
widget.hwnd, win32con.SW_SHOW) # 显示窗口
widget.close()
self.layout().removeWidget(widget) # 从布局中移出
widget.deleteLater()