Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 58125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:47:56+00:00 2026-05-10T17:47:56+00:00

This isn’t as malicious as it sounds, I want to get the current size

  • 0

This isn’t as malicious as it sounds, I want to get the current size of their windows, not look at what is in them. The purpose is to figure out that if every other window is fullscreen then I should start up like that too. Or if all the other processes are only 800×600 despite there being a huge resolution then that is probably what the user wants. Why make them waste time and energy resizing my window to match all the others they have? I am primarily a Windows devoloper but it wouldn’t upset me in the least if there was a cross platform way to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:47:57+00:00Added an answer on May 10, 2026 at 5:47 pm

    Using hints from WindowMover article and Nattee Niparnan’s blog post I managed to create this:

    import win32con import win32gui  def isRealWindow(hWnd):     '''Return True iff given window is a real Windows application window.'''     if not win32gui.IsWindowVisible(hWnd):         return False     if win32gui.GetParent(hWnd) != 0:         return False     hasNoOwner = win32gui.GetWindow(hWnd, win32con.GW_OWNER) == 0     lExStyle = win32gui.GetWindowLong(hWnd, win32con.GWL_EXSTYLE)     if (((lExStyle & win32con.WS_EX_TOOLWINDOW) == 0 and hasNoOwner)       or ((lExStyle & win32con.WS_EX_APPWINDOW != 0) and not hasNoOwner)):         if win32gui.GetWindowText(hWnd):             return True     return False  def getWindowSizes():     '''     Return a list of tuples (handler, (width, height)) for each real window.     '''     def callback(hWnd, windows):         if not isRealWindow(hWnd):             return         rect = win32gui.GetWindowRect(hWnd)         windows.append((hWnd, (rect[2] - rect[0], rect[3] - rect[1])))     windows = []     win32gui.EnumWindows(callback, windows)     return windows  for win in getWindowSizes():     print win 

    You need the Win32 Extensions for Python module for this to work.

    EDIT: I discovered that GetWindowRect gives more correct results than GetClientRect. Source has been updated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although I know this isn't very efficient, I need to get this working fast
This isn't legal: public class MyBaseClass { public MyBaseClass() {} public MyBaseClass(object arg) {}
This isn't a holy war, this isn't a question of which is better. What
This isn't a question but I thought I'd start a thread where links to
This isn't my code; I am trying to figure out what exactly this does.
This isn't working. Can this be done in find? Or do I need to
this isn't asp.net specific, some of these apps are WinForms, also will be adding
This isn't quite as straight forward as one may think. I'm using a plugin
I know this isn't strictly a programming question but y'all must have experienced this.
I know this isn't strictly speaking a programming question but something I always hear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.