0

Okay so I'm using win32gui.SetForegroundWindow(hwnd_here) to try and give focus to or at least set to the foreground a specific window. My problem is that the hwnd changes each time the program is closed and restarted again.

Is there a way of programmatically getting the specific hwnd for that session with a partial window name or title using win32gui?

martineau
  • 119,623
  • 25
  • 170
  • 301
BipBop
  • 1
  • Use `win32gui.FindWindow` – Anon Coward Jul 31 '22 at 01:53
  • See [Get HWND of each Window?](https://stackoverflow.com/questions/14653168/get-hwnd-of-each-window) – martineau Jul 31 '22 at 01:59
  • Thank you for these answers and the edit of my post! I will make sure to learn how to post properly. My apologies for the initial unedited version. Both of the answers proved useful to me. – BipBop Jul 31 '22 at 06:26

0 Answers0