Пример #1
0
 def CreateWindow(self):
     # modeless. Pages should have the WS_CHILD window style
     message_map = self.GetMessageMap()
     # remove frame from dialog and make sure it is a child
     self.template[0][2] = self.template[0][2] & ~(win32con.DS_MODALFRAME|win32con.WS_POPUP|win32con.WS_OVERLAPPED|win32con.WS_CAPTION)
     self.template[0][2] = self.template[0][2] | win32con.WS_CHILD
     return win32gui.CreateDialogIndirect(self.hinst, self.template, self.parent, message_map)
Пример #2
0
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)
        def __create_window(self):
            message_map = {
                win32con.WM_INITDIALOG: self.__on_init_dialog,
                win32con.WM_CLOSE: self.__on_close,
                win32con.WM_COMMAND: self.__on_command,
                win32con.WM_NOTIFY: self.__on_spin_change,
            }

            win32gui.CreateDialogIndirect(
                0, self.resources.dialogs['IDD_CHANGE_TIME'], 0, message_map)
Пример #4
0
    def __init__(self, log_file_name=""):
        self.set_logger(log_file_name)
        message_map = {
            win32con.WM_SIZE: self.on_size,
            win32con.WM_COMMAND: self.on_command,
            win32con.WM_NOTIFY: self.on_notify,
            win32con.WM_INITDIALOG: self.on_init_dialog,
            win32con.WM_CLOSE: self.on_close,
            win32con.WM_DESTROY: self.on_destroy,
            win32con.WM_KEYDOWN: self.on_keydown,
            win32con.WM_KEYUP: self.on_keyup,
            win32con.WM_GETTEXT: self.on_gettext
        }

        self._register_wnd_class()
        template = self._get_dialog_template()

        # Create the window via CreateDialogBoxIndirect - it can then
        # work as a "normal" window, once a message loop is established.
        win32gui.CreateDialogIndirect(hInstance, template, 0, message_map)