Exemple #1
0
def getNoesisWindowRect():
	hNoesisWnd = noesis.getWindowHandle()
	if hNoesisWnd:
		rect = RECT()
		if user32.GetWindowRect(hNoesisWnd, byref(rect)):
			return (rect.left, rect.top, rect.right, rect.bottom)
	return None
    def createWindow(self):
        windowClass = WNDCLASSEX()
        windowClass.cbSize = sizeof(WNDCLASSEX)
        windowClass.style = CS_HREDRAW | CS_VREDRAW
        windowClass.lpfnWndProc = self.windowProc
        windowClass.cbClsExtra = 0
        windowClass.cbWndExtra = 0
        windowClass.hInstance = self.hInst
        windowClass.hIcon = user32.LoadIconW(
            0, IDI_INFORMATION) if not self.userIcon else self.userIcon
        windowClass.hCursor = user32.LoadCursorW(0, IDC_ARROW)
        windowClass.hBrush = user32.GetSysColorBrush(COLOR_WINDOW)  #COLOR_MENU
        if not windowClass.hBrush:
            windowClass.hBrush = gdi32.GetStockObject(WHITE_BRUSH)
        windowClass.lpszMenuName = 0
        windowClass.lpszClassName = self.windowClassName
        windowClass.hIconSm = 0

        if user32.RegisterClassExW(byref(windowClass)) == 0:
            return False

        hParentWnd = noesis.getWindowHandle()
        hWnd = user32.CreateWindowExW(self.exStyle, self.windowClassName,
                                      self.windowName, self.style, self.x,
                                      self.y, self.width, self.height,
                                      hParentWnd, 0, self.hInst, 0)
        if not hWnd:
            return False

        user32.ShowWindow(hWnd, SW_SHOW)
        self.hWnd = hWnd
        self.hParentWnd = hParentWnd
        liveWindows[hWnd] = self
        return True