Questions tagged [user32]

user32.dll implements the Windows USER component that creates and manipulates the standard elements of the Windows user interface, such as the desktop, windows, and menus.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
61 views

Migrating code to C#/Win32 causes exceptions

In our (WinUI3-based) project, we've been using the P/Invoke packages to call low-level methods that modify the windows. But recently all these packages have been deprecated in favor of the source-...
JHBonarius's user avatar
0 votes
0 answers
48 views

SetWindowsHookEx always returning 0 with error code 87 (ERROR_INVALID_PARAMETER) in .net 8 WPF

In my application I would like to register a hook per SetWindowsHookEx. Basically I would like to execute some code, whenever a mouse event occurs. The method however, always returns 0. The last error ...
Holunk's user avatar
  • 79
-1 votes
1 answer
83 views

Active window-title

I want to get the string of the title of the currently active window in a C# console application. My below code does just that. However, it only works when I debug the code slowly line by line. When I ...
Pingui's user avatar
  • 1,420
1 vote
0 answers
57 views

Capture a screenshot of a newly created desktop not working win api

using System.Diagnostics; using System.Drawing.Imaging; using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Windows.Media.Imaging; internal class Program { ...
Alexander Jansson's user avatar
0 votes
0 answers
35 views

Get Window Title by ApplicationName.exe

Why does the code line under ❶ Nothing found fire when I call the below C# .dll like so: WindowNameGetter::GetWindowName("MyAppName.exe"); (...and "MyAppName.exe" really is up and ...
Pingui's user avatar
  • 1,420
0 votes
0 answers
61 views

How to capture a snapshot of a specific window in WinForms without capturing any other windows that hover over it

Unable to capture a snapshot of a specific window in WinForms. I have tried to capture the WinForms window specifically. However, it captures the snapshot along with portions of other windows. I have ...
BAGAVATHI PERUMAL A's user avatar
0 votes
1 answer
71 views

SetWindowPos doesn't work with VSCode windows

I'm trying to move the VSCode window using SetWindowPos (in PowerShell, however the same should apply to C++ or C# PInvoke) and I cannot get it to work. Even more frustratingly NirSoft's GUIPropView ...
kwyntes's user avatar
  • 1,119
0 votes
0 answers
48 views

How to find the MainWindowHandle of a WinForms process for capturing a snapshot of the whole window instead of capturing only the popup window

Unable to capture the entire WinForms window when the popup/Dropdown window is open. It only captures a snapshot of the popup window. The WinForm process mainwindow handle retrieves only the dropdown ...
BAGAVATHI PERUMAL A's user avatar
1 vote
0 answers
81 views

Why does `SW_HIDE` leave a ghost after forcibly setting a game's window style to `WS_POPUP`?

I am trying to hide Factorio window after removing its border by setting its style to WS_POPUP. When I call ShowWindow(factorio, SW_HIDE) the window leaves behind a black box, that is transparent to ...
LOST's user avatar
  • 3,000
0 votes
0 answers
95 views

C# Winform Application detected by Kaspersky as Trojan (HEUR:Trojan-Spy.MSIL.Bobik.gen)

I have a C# Winform application, Its purpose is copy text in clipboard. But when I build the project I get Kaspersky report as (HEUR:Trojan-Spy.MSIL.Bobik.gen) and it deletes my .exe file. I found ...
Lee Dungx's user avatar
  • 101
0 votes
3 answers
148 views

C# SCROLLINFO not working on Chrome window

I am attempting to retrieve scroll information from the window handle, but I keep getting a value of 0. I am pursuing this approach because my goal is to capture a complete scrolling screenshot of the ...
Ankur Tripathi's user avatar
1 vote
0 answers
31 views

Changing primary monitor moves fullscreen window

I'm trying to programmatically change the primary monitor on a Windows desktop PC. When I change the primary display programmatically, a full-screen VMWare console window automatically moves to the ...
Călin Darie's user avatar
  • 5,987
1 vote
0 answers
120 views

WinAPI: draw RGBA image

I know there are a lot of answers related with this question, but I read them all and still don't understand. My target is to draw RGBA image on the top of all windows using WinAPI. For this I make ...
Anaph's user avatar
  • 21
0 votes
1 answer
100 views

How can I get the default/recommend monitor device mode in C# or C++?

I can get all monitor modes (DEVMODEA) by EnumDisplaySettingsA, e.g. as in this C# snippet: public static extern int EnumDisplaySettingsA(string lpszDeviceName, int iModeNum, ref DEVMODEA lpDevMode); ...
Horst Walter's user avatar
  • 13.7k
0 votes
0 answers
58 views

making a cube rotating, making the old disappear

im trying to create an app with a rotating cube, and i created the window, then when i press 'p' my cube is create and every time the pc get the 'p' pressed the cube rotates. the issue is that the old ...
Matteo Rocco Micò's user avatar
0 votes
0 answers
132 views

Cannot get handle of Edit control from notepad using Windows 11

I have several ways to get notepad's edit control handle: Using user32 FindWindowEx(ForegroundHandle, IntPtr.Zero, "Edit", null); Using Automation var notepadWindow = AutomationElement....
oyashchyshyn's user avatar
0 votes
0 answers
15 views

Selenium controlled Chromium process hidden by (user32.dll) ShowWindow will still appear sometimes

We have a WPF (.NET Framework 4.7.2) application that parses a government site for information (and downloads documents) using Chromium (116) with Selenium (4.10.0). We keep that Chromium process ...
Ja Da's user avatar
  • 278
1 vote
0 answers
60 views

The printwindow function works on some computers but not on others

I wrote some code inside a Winform. I have one panel and one PictureBox. As can be seen in the codes below; I open an exe program called Stellerium in the panel. I painted this program, which I opened ...
bozmech's user avatar
  • 53
0 votes
1 answer
35 views

How to synchronize size of a child window in WPF to match that of a parent

I have a MainWindow in WPF that creates another window (Window1) and using SetParent from user32.dll sets MainWindow as parent of Window1. this is my code for MainWindow Class MainWindow Dim Window1 ...
iTDy0lyMSN's user avatar
0 votes
0 answers
77 views

Disable WS_EX_COMPOSITED for individual child windows?

I've programmed an application that superimposes semi-transparent child windows. For this I use the flag WS_EX_COMPOSITED in a common parent window. Now I've found a provider that renders 3D models, ...
René Rössler's user avatar
0 votes
0 answers
58 views

user32.dll keybd_event not working on windows service C#

I created a windows service that writes a text when it receives it Debugging the service works, but when I already install it it doesn't work. This is my code public static class KeyboardSimulator ...
Josue Barrios's user avatar
0 votes
0 answers
19 views

windows service can't access desktop UI

recently I made a service that get the current active window of the user for windows which uses GetForegroundWindow in user32.dll and it's perfectly working while running as a console application, but ...
Mamink's user avatar
  • 307
1 vote
1 answer
119 views

How does Windows 11 implement the search input in the taskbar? [closed]

I am looking to build an app that will live on the taskbar but needs to have an extended size (i.e. not just be a square icon). I know that these types of apps are extremely uncommon in the Windows ...
Ruslan's user avatar
  • 2,731
2 votes
2 answers
403 views

How do I use Register-ObjectEvent to detect change in MainWindowTitle of a process in PowerShell?

I've looked hard for any examples about .Net events revealing a change of the MainWindowTitle of a process (or a corresponding property). For detecting changes to file content I can simply use ...
Dennis's user avatar
  • 1,005
0 votes
0 answers
83 views

What Windows Messages Must I Send For WM_LBUTTONDOWN To Click

Goal I am trying to use SendMessage / Post message to send WM_LBUTTONDOWN and WM_LBUTTONUP to a window. What I've Tried In the docs it indicates there are some conditions under which this message will ...
Noah Huppert's user avatar
  • 4,088
1 vote
0 answers
42 views

C# FindWindowsEx unable to get child handle

I want to launch an external application and get the handle of its Connect button. I get the top level "000A0B32" and I can get this 100% correct. Then I'm trying to get the child element &...
okaken's user avatar
  • 13
-1 votes
1 answer
70 views

The application interface stops responding when dragging a window

I needed to implement my own title bar for the application windows. For this I created a UserControl. To implement moving the window I used SendMessage(_windowInteropHelper.Handle, 0x112, 0xf012, 0). ...
Yili's user avatar
  • 3
1 vote
0 answers
126 views

Windows 11: What is this white bar at the top of my titlebarless window & can I get rid of it?

I have the following Python code: import ctypes import ctypes.wintypes import win32gui user32 = ctypes.WinDLL("user32.dll") # Define the window class WNDCLASS = win32gui.WNDCLASS() ...
Willy Wonka's user avatar
0 votes
0 answers
116 views

How to debug Windows dll from Delphi

CodeGear™ Delphi® 2007 for Win32® R2 Version 11.0.2902.10471 Working on an application written in Delphi Pascal that calls a DLL (also Delphi) that changes a panel in the GUI. Occasionally during the ...
Gary Barnes's user avatar
1 vote
1 answer
319 views

How to find (virtual) desktop that a window resides on?

I use multiple desktops on Windows, and I am trying to determine which desktop a window resides on. I can retrieve the position of a window using GetWindowRect (from user32.dll), but this doesn't tell ...
yeerk's user avatar
  • 2,252
0 votes
0 answers
27 views

Window mouse message can not fire wile configured with ~WS_BORDER [duplicate]

In a WPF applicaiton, creating a native window using User32 API, while configuring the WindowStyle with '~WindowStyles.WS_BORDER', the mouse messages can not be fired in the WndProc handler function. ...
Iron's user avatar
  • 926
1 vote
0 answers
97 views

What is the difference between WS_OVERLAPPED/WS_TILED and WS_CAPTION?

What is the difference between WS_OVERLAPPED / WS_TILED and WS_CAPTION? What is the difference between setting and not setting WS_OVERLAPPED?
Xi Minghui's user avatar
0 votes
0 answers
114 views

Can anyone help me to fix this weird behaviour with windows desktops?

So, I was exploring the user32 functions when I discovered desktops. I wrote a small program about them: #include <windows.h> int main () { HDESK newdesk = CreateDesktopA("newdesktop&...
payback2 crashes's user avatar
1 vote
1 answer
219 views

Duration of the busy cursor when launching a Windows desktop application

When you launch a Windows desktop application, the system changes the arrow to one with an animated busy spinner (presumably from IDI_ARROW to IDI_APPSTARTING). Once the application presents a window,...
Adrian McCarthy's user avatar
2 votes
1 answer
152 views

Cannot capture user input from within an old game. Using user32.dll

I am trying to make a program that runs in the background when activated by a hotkey, it captures keyboard and mouse inputs then you can replay thoose inputs if another hotkey is pressed. The concept ...
adam sranko's user avatar
1 vote
1 answer
57 views

Why is AsyncKeyState stuck?

I am trying to write a script that can record and reproduce, a user input. Technically in the current state of the code its a keylogger. I am using [DllImport("user32.dll")] to solve the ...
adam sranko's user avatar
1 vote
0 answers
27 views

Black edges appear when window is transparent

I used the following method to successfully make the window transparent, but some windows will have black edges, how should I solve it WindowApi.SetWindowLong(winPtr, -20, WindowApi.GetWindowLong(...
kuse j's user avatar
  • 11
0 votes
0 answers
214 views

C# (RawInput, RegisterRawInputDevices)

A function "RegisterRawInputDevices(RawInputDeviceRegistration[] pRawInputDevices, uint uiNumDevices, uint cbSize)" from user32.dll blocks the main GUI thread. Is there a way to keep GUI ...
ITDimk's user avatar
  • 3
1 vote
1 answer
270 views

Fetching the HWND of a Win32 control using global screen coordinates

Background I need to implement some Spy++-esque functionality for an Windows application automation project. For simplicity's sake, let us assume that my application A (written in C# or C++) is trying ...
unknown6656's user avatar
  • 2,833
0 votes
1 answer
328 views

Calling Windows SendMessageW from GOlang never returns

Trying to write a very simple GO program for Windows that turns off the monitor. The code looks like this: //go:build windows // +build windows package main import ( log "github.com/...
JD Allen's user avatar
  • 824
1 vote
1 answer
188 views

MessageBox User32.dll, how to add links (Go programming language)

I discovered how to create a simple MessageBox in Go using this Stackoverflow answer: https://stackoverflow.com/a/71919136/14997578 This uses the user32 Windows DLL to create it. The problem is that ...
Bellisario's user avatar
0 votes
1 answer
131 views

FindWindowA function does not yield the expected output in dart foreign function interface

The following dart code's expected output is the handle to the file explorer window but the output always comes out to be 0 even though the file explorer window does exist! import 'package:ffi/ffi....
Sanmay Kant's user avatar
0 votes
0 answers
219 views

Trying to capture an specific part of a hidden window

Been losing some days on this, I'm trying to capture an specific part of a hidden window, like per example, capture only coordinates 300, 300 to 350, 350. I'm trying to do some image recognition and ...
guilhermemrk's user avatar
0 votes
1 answer
65 views

VBA loses flow of control when button calls new window using user32 libraries

I am using VBA with user32 libraries to manipulate windows. In the application I am making, when I click on a certain button for which I already have the handle, a new window appropriately pops up. ...
Brandon Redmond's user avatar
1 vote
0 answers
117 views

C#: Why programmatically pressing keyboard shortcuts doesn't work in all windows? [duplicate]

There is a code that, when a certain key/key combination is pressed, programmatically presses the key combination CTRL+A (Select text in line). Problem: Everything works fine in notepad, browser, ...
denisnumb's user avatar
-1 votes
1 answer
35 views

Program freezes and won't close when left click is simulated

It's as simple as that. I've been trying to code something that simply left clicks in a certain position, but no matter what programming language I use, the program fails to do so, freezes, refuses to ...
Mittato's user avatar
1 vote
0 answers
126 views

Creating a KeyEventArgs field with the desired KeyCode value in C#

I wanna make an opportunity to rebind some buttons. I have "launchParametrs.txt" file so the KeyEventArgs field must get KeyCode from "Start: (bind button from file)". But I can't ...
kapiton's user avatar
  • 11
0 votes
0 answers
692 views

How to check if mouse click triggered by user32.dll or real user [duplicate]

private const int WH_MOUSE_LL = 14; public static LowLevelMouseProc _proc = HookCallback; public static IntPtr _hookID = IntPtr.Zero; [DllImport("user32.dll")] public static extern bool ...
JY Lee's user avatar
  • 45
3 votes
1 answer
651 views

PYQT5: Window does not get the focus

I want to create my own virtual keyboard. However, it always happens that the focus is taken from another window as soon as a button is pressed or the window is opened. How can I work around this ...
Robin Fauser's user avatar
1 vote
1 answer
245 views

SetWindowsHookEx(WH_SHELL, ...): What is the meaning of event HSHELL_WINDOWREPLACED?

If I register a hook via SetWindowsHookEx(WH_SHELL, ShellProc, ...), what is the meaning of event HSHELL_WINDOWREPLACED? (My Google-fu fails me. I have searched high and low!) Win32 Docs: ...
kevinarpe's user avatar
  • 20.5k

1
2 3 4 5
12