Questions tagged [win32gui]

NOT FOR GENERAL WIN32 PROGRAMMING QUESTIONS (use [winapi])! This is ONLY for questions about the "Win32GUI" library, which is a C++ library for Win32 GUI programming.

Win32GUI is a C++ generic library for Win32 GUI programming.

It features real GUI RAII (Resources Acquisition Is Initialization), event handling, easy manipulation of standard controls, thread-safety and simple menu handling.

865 questions
43
votes
5 answers

How to detect Windows 10 light/dark mode in Win32 application?

A bit of context: Sciter (pure win32 application) is already capable to render UWP alike UIs: in dark mode: in light mode: Windows 10.1803 introduces Dark/Light switch in Settings applet as seen here for example. Question: how do I determine…
c-smile
  • 26,734
  • 7
  • 59
  • 86
31
votes
5 answers

How do I find position of a Win32 control/window relative to its parent window?

Given handle of a Win32 window, I need to find position of it relative to its parent window. I know several functions (e.g.; GetWindowRect() and GetClientRect()), but none of them explicitly return the desired coordinates. How do I do this?
hkBattousai
  • 10,583
  • 18
  • 76
  • 124
26
votes
6 answers

Opening a window that has no title bar with Win32

I'm developing a C++ application for Windows. I'm using the Win32 API. How can I open a window without a title bar (without controls, icon and title) and that can not be resized. The piece of code that I am using for the application to create a…
blejzz
  • 3,349
  • 4
  • 39
  • 60
22
votes
3 answers

How to get a list of the name of every open window?

How do I get a list of the name/text of all opened windows? I tried pywinauto: pywinauto.findwindows.find_windows(title_re="*") but using * as a regex raises an error I tried win32gui: It…
user10385242
  • 407
  • 1
  • 3
  • 10
20
votes
1 answer

Screenshot of inactive window PrintWindow + win32gui

After hours of googling I managed to "write" this: import win32gui from ctypes import windll hwnd = win32gui.FindWindow(None, 'Steam') hdc = win32gui.GetDC(hwnd) hdcMem = win32gui.CreateCompatibleDC(hdc) hbitmap =…
Maksim
  • 357
  • 1
  • 3
  • 11
19
votes
3 answers

Add image in window tray menu

I am writing simple tray for windows using python. I succeeded in creating a tray icon, menu, sub menu. I stucked at adding image for particular tray item. here is code I used. (Link) Even this code did not work. Windows documentation is not…
Durgaprasad
  • 1,910
  • 2
  • 25
  • 44
17
votes
1 answer

Capture the "Save your changes" dialog when using win32gui and closing an embedded application within a QApplication?

I am embedding an application within a tab in a pyqt QApplication. When I close the tab this application is embedded in how do I allow it to display the "Save your changes" dialog? I use this on…
Andy
  • 49,085
  • 60
  • 166
  • 233
15
votes
2 answers

Python win32gui SetAsForegroundWindow function not working properly

I am trying to write a program that finds a window by searching for its title. Once it has found the window, it will attempt to bring it to front. I am using win32gui API to achieve this. I am able to get it to work for the most part, but for some…
Aasam Tasaddaq
  • 645
  • 4
  • 13
  • 23
15
votes
1 answer

Installing win32gui python module

I am trying to get the name of the window currently in focus by running this code... import win32gui name = win32gui.GetForegroundWindow() However, I keep getting Traceback (most recent call last): File "D:\Program_1\test.py", line 1, in…
user3014911
  • 169
  • 1
  • 1
  • 6
14
votes
2 answers

How to use the win32gui module with Python?

Im my Python file, I have imported the win32gui module like this: import win32gui I have also downloaded win32gui but don't know how to make my script run. How can I run my Python script which imports win32gui? When I run it, I get: ImportError: No…
Harry Joy
  • 58,650
  • 30
  • 162
  • 207
14
votes
3 answers

win32gui.SetActiveWindow() ERROR : The specified procedure could not be found

I get the active window like so: window = win32gui.GetForegroundWindow() which is an Int, say 1053634. And afterwards I try to set the foreground window back to the specified window: win32gui.SetForegroundWindow(window) And I get this error: …
Wise
  • 628
  • 2
  • 11
  • 25
13
votes
3 answers

what is the difference between win32 application, windows form application and console application?

I want to know what is the difference between windows form application, win32application ana console, i know that both the windows form application and win32 application is gui tool, but i want to know when to use one over the other one, and could I…
sara
  • 256
  • 1
  • 3
  • 15
12
votes
1 answer

Prevent desktop sharing of a particular c# winforms or detect desktop sharing

While developing an examination software I have a requirement to prevent desktop sharing through applications like TeamViewer, AnyDesk, Ammyy Admin etc or at least detection of it. Our examination software is developed in C#, it's a winform renders…
Amogh
  • 4,453
  • 11
  • 45
  • 106
12
votes
2 answers

How to enable tab and arrow keys using python win32gui

I've created several buttons (windows) in a main window, but tab and arrow keys are not working. My research revealed that for C++, the use of IsDialogMessage in the message pump creates a bypass of TranslateMessage/DispatchMessage as follows to…
mjpsr11
  • 595
  • 3
  • 10
  • 25
11
votes
2 answers

win32gui get the current active application name

I am just learning python and I am relativity new to it. I created the following script that will get the current active windows title and print it to the window. import win32gui windowTile = ""; while ( True ) : newWindowTile =…
Steven Smethurst
  • 4,495
  • 15
  • 55
  • 92
1
2 3
57 58