本文整理汇总了Python中win32con.WM_DESTROY属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.WM_DESTROY属性的具体用法?Python win32con.WM_DESTROY怎么用?Python win32con.WM_DESTROY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.WM_DESTROY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_new_desktop_name
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
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)
示例2: initialize
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
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
示例3: quit_game
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def quit_game(self):
"""
退出游戏
"""
self.takescreenshot() # 保存一下现场
self.clean_mem() # 清理内存
if not self.run:
return False
if self.quit_game_enable:
if self.client == 0:
win32gui.SendMessage(
self.hwnd, win32con.WM_DESTROY, 0, 0) # 退出游戏
else:
os.system(
'adb shell am force-stop com.netease.onmyoji.netease_simulator')
logging.info('退出,最后显示已保存至/img/screenshots文件夹')
sys.exit(0)
示例4: _dialog_build_message_map
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
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.
示例5: default_message_map
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def default_message_map(self):
message_map = {
win32con.WM_COMMAND: self._on_command,
win32con.WM_DESTROY: self._on_destroy,
}
return message_map
示例6: Create
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def Create(self, title, style, rect, parent):
classStyle = win32con.CS_HREDRAW | win32con.CS_VREDRAW
className = win32ui.RegisterWndClass(classStyle, 0, win32con.COLOR_WINDOW+1, 0)
self._obj_ = win32ui.CreateWnd()
self._obj_.AttachObject(self)
self._obj_.CreateWindow(className, title, style, rect, parent, win32ui.AFX_IDW_PANE_FIRST)
self.HookMessage (self.OnSize, win32con.WM_SIZE)
self.HookMessage (self.OnPrepareToClose, WM_USER_PREPARE_TO_CLOSE)
self.HookMessage (self.OnDestroy, win32con.WM_DESTROY)
self.timerid = timer.set_timer (100, self.OnTimer)
self.InvalidateRect()
示例7: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def __init__(self, initobj=None):
object.CmdTarget.__init__(self, initobj)
if self._obj_: self._obj_.HookMessage(self.OnDestroy, win32con.WM_DESTROY)
示例8: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_SIZE: self.OnSize,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_NOTIFY: self.OnNotify,
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
WM_SEARCH_RESULT: self.OnSearchResult,
WM_SEARCH_FINISHED: self.OnSearchFinished,
}
dlgClassName = self._RegisterWndClass()
template = self._GetDialogTemplate(dlgClassName)
return fn(self.hinst, template, 0, message_map)
示例9: desktop_name_dlgproc
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def desktop_name_dlgproc(hwnd,msg,wparam,lparam):
""" Handles messages from the desktop name dialog box """
if msg in (win32con.WM_CLOSE,win32con.WM_DESTROY):
win32gui.DestroyWindow(hwnd)
elif msg == win32con.WM_COMMAND:
if wparam == win32con.IDOK:
desktop_name=win32gui.GetDlgItemText(hwnd, 72)
print 'new desktop name: ',desktop_name
win32gui.DestroyWindow(hwnd)
create_desktop(desktop_name)
elif wparam == win32con.IDCANCEL:
win32gui.DestroyWindow(hwnd)
示例10: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
}
return fn(0, self.dlg_template, 0, message_map)
示例11: _DoCreate
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def _DoCreate(self, fn):
message_map = {
win32con.WM_SIZE: self.OnSize,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_NOTIFY: self.OnNotify,
win32con.WM_INITDIALOG: self.OnInitDialog,
win32con.WM_CLOSE: self.OnClose,
win32con.WM_DESTROY: self.OnDestroy,
}
dlgClassName = self._RegisterWndClass()
template = self._GetDialogTemplate(dlgClassName)
return fn(self.hinst, template, 0, message_map)
示例12: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def __init__(self):
super(Shell, self).__init__()
msg_taskbar_restart = win32gui.RegisterWindowMessage("TaskbarCreated")
self.message_map = {msg_taskbar_restart: self.OnRestart,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_USER + 20: self.OnTaskbarNotify, }
self.main_frame = MainFrame(self.message_map)
self.status_icon = StatusIcon(self)
self.notice_index = -1 # rolling index of topmost notice in the queue
self.console = None
self.destroyed = False
示例13: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def __init__(self):
# Register window class; it's okay to do this multiple times
wc = WNDCLASS()
wc.lpszClassName = 'ServoTaskbarNotification'
wc.lpfnWndProc = {win32con.WM_DESTROY: self.OnDestroy, }
self.classAtom = RegisterClass(wc)
self.hinst = wc.hInstance = GetModuleHandle(None)
示例14: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def __init__(self, title, msg):
message_map = {
win32con.WM_DESTROY: self.on_destroy,
}
# Register the Window class.
wc = WNDCLASS()
hinst = wc.hInstance = GetModuleHandle(None)
wc.lpszClassName = "PythonTaskbarDemo"
wc.lpfnWndProc = message_map # could also specify a wndproc.
class_atom = RegisterClass(wc)
# Create the Window.
style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
self.hwnd = CreateWindow(class_atom, "Taskbar Demo", style,
0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
0, 0, hinst, None)
UpdateWindow(self.hwnd)
icon_path_name = os.path.abspath(os.path.join(sys.prefix, "pyc.ico"))
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
# noinspection PyBroadException
try:
hicon = LoadImage(hinst, icon_path_name, win32con.IMAGE_ICON, 0, 0, icon_flags)
except:
hicon = LoadIcon(0, win32con.IDI_APPLICATION)
flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
nid = (self.hwnd, 0, flags, win32con.WM_USER + 20, hicon, "Balloon tooltip demo")
Shell_NotifyIcon(NIM_ADD, nid)
self.show_balloon(title, msg)
time.sleep(20)
DestroyWindow(self.hwnd)
示例15: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_DESTROY [as 别名]
def __init__(self):
message_map = {
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
win32con.WM_SIZE: self.OnSize,
}
# Register the Window class.
wc = win32gui.WNDCLASS()
hinst = wc.hInstance = win32api.GetModuleHandle(None)
wc.lpszClassName = "test_explorer_browser"
wc.lpfnWndProc = message_map # could also specify a wndproc.
classAtom = win32gui.RegisterClass(wc)
# Create the Window.
style = win32con.WS_OVERLAPPEDWINDOW | win32con.WS_VISIBLE
self.hwnd = win32gui.CreateWindow( classAtom, "Python IExplorerBrowser demo", style, \
0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \
0, 0, hinst, None)
eb = pythoncom.CoCreateInstance(shellcon.CLSID_ExplorerBrowser, None, pythoncom.CLSCTX_ALL, shell.IID_IExplorerBrowser)
# as per MSDN docs, hook up events early
self.event_cookie = eb.Advise(wrap(EventHandler()))
eb.SetOptions(shellcon.EBO_SHOWFRAMES)
rect = win32gui.GetClientRect(self.hwnd)
# Set the flags such that the folders autoarrange and non web view is presented
flags = (shellcon.FVM_LIST, shellcon.FWF_AUTOARRANGE | shellcon.FWF_NOWEBVIEW)
eb.Initialize(self.hwnd, rect, (0, shellcon.FVM_DETAILS))
if len(sys.argv)==2:
# If an arg was specified, ask the desktop parse it.
# You can pass anything explorer accepts as its '/e' argument -
# eg, "::{guid}\::{guid}" etc.
# "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" is "My Computer"
pidl = shell.SHGetDesktopFolder().ParseDisplayName(0, None, sys.argv[1])[1]
else:
# And start browsing at the root of the namespace.
pidl = []
eb.BrowseToIDList(pidl, shellcon.SBSP_ABSOLUTE)
# and for some reason the "Folder" view in the navigator pane doesn't
# magically synchronize itself - so let's do that ourself.
# Get the tree control.
sp = eb.QueryInterface(pythoncom.IID_IServiceProvider)
try:
tree = sp.QueryService(shell.IID_INameSpaceTreeControl,
shell.IID_INameSpaceTreeControl)
except pythoncom.com_error, exc:
# this should really only fail if no "nav" frame exists...
print "Strange - failed to get the tree control even though " \
"we asked for a EBO_SHOWFRAMES"
print exc