当前位置: 首页>>代码示例>>Python>>正文


Python win32con.WM_CLOSE属性代码示例

本文整理汇总了Python中win32con.WM_CLOSE属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.WM_CLOSE属性的具体用法?Python win32con.WM_CLOSE怎么用?Python win32con.WM_CLOSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在win32con的用法示例。


在下文中一共展示了win32con.WM_CLOSE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_new_desktop_name

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:desktopmanager.py

示例2: enumCallback

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def enumCallback(hwnd, self):
            title = win32gui.GetWindowText(hwnd)

            for name in self.WindowNames:
                if title.find(name) > -1:
                    try:
                        self.FoundWindowEvent.set()

                        if self.CloseWindows:
                            win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
                    except:
                        pass
                else:
                    try:
                        win32gui.EnumChildWindows(hwnd, _WindowWatcher.enumChildCallback, self)
                    except:
                        pass

            return True 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:21,代码来源:gui.py

示例3: enumCallback

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def enumCallback(hwnd, args):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            proc = args[0]
            windowName = args[1]

            try:
                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    win32gui.EnumChildWindows(hwnd, FileWriterLauncherGui.enumChildCallback, args)
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
            except:
                pass 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:24,代码来源:file.py

示例4: enumChildCallback

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def enumChildCallback(hwnd, args):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            proc = args[0]
            windowName = args[1]

            try:

                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)

            except:
                pass
            #print sys.exc_info() 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:26,代码来源:file.py

示例5: enumChildCallback

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def enumChildCallback(hwnd, windowName):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            try:

                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)

            except:
                pass
            #print sys.exc_info() 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:23,代码来源:process.py

示例6: enumCallback

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def enumCallback(hwnd, windowName):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            try:
                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    win32gui.EnumChildWindows(hwnd, FileWriterLauncherGui.enumChildCallback, windowName)
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
            except:
                pass 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:21,代码来源:process.py

示例7: initialize

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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 
开发者ID:euske,项目名称:pyrexecd,代码行数:22,代码来源:__init__.py

示例8: GUIAboutToBreak

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def GUIAboutToBreak(self):
		"Called as the GUI debugger is about to get context, and take control of the running program."
		self.GUICheckInit()
		self.RespondDebuggerState(DBGSTATE_BREAK)
		self.GUIAboutToInteract()
		if self.pumping:
			print "!!! Already pumping - outa here"
			return
		self.pumping = 1
		win32ui.StartDebuggerPump() # NOTE - This will NOT return until the user is finished interacting
		assert not self.pumping, "Should not be pumping once the pump has finished"
		if self.frameShutdown: # User shut down app while debugging
			win32ui.GetMainFrame().PostMessage(win32con.WM_CLOSE) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:debugger.py

示例9: _DoCreate

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:win32gui_dialog.py

示例10: desktop_name_dlgproc

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:desktopmanager.py

示例11: kill

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def kill(self, gracePeriod=5000):
        """
        Kill process. Try for an orderly shutdown via WM_CLOSE.  If
        still running after gracePeriod (5 sec. default), terminate.
        """
        win32gui.EnumWindows(self.__close__, 0)
        if self.wait(gracePeriod) != win32event.WAIT_OBJECT_0:
            win32process.TerminateProcess(self.hProcess, 0)
            win32api.Sleep(100) # wait for resources to be released 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:winprocess.py

示例12: _DoCreate

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:win32rcparser_demo.py

示例13: _dialog_build_message_map

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [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. 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:30,代码来源:dialog_base.py

示例14: stop

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def stop(self, appname, extra={}):
        '''appname is not used in windows interferences'''
        win32gui.SendMessage(self.HWND,win32con.WM_CLOSE,0,0) 
开发者ID:NetEase,项目名称:airtest,代码行数:5,代码来源:windows.py

示例15: crashwindow

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import WM_CLOSE [as 别名]
def crashwindow():
	top_windows = []
	win32gui.EnumWindows(windowEnumerationHandler, top_windows)
	for i in top_windows:
		if "BATTLEGROUNDS Crash Reporter" in i[1]:
			win32gui.PostMessage(i[0],win32con.WM_CLOSE,0,0)
			l("crash window closed")
			return True
	return False

# pyinput helper functions 
开发者ID:xulusjb,项目名称:PUBG,代码行数:13,代码来源:main.py


注:本文中的win32con.WM_CLOSE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。