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.
Questions tagged [user32]
547 questions
37
votes
3 answers
Send keys through SendInput in user32.dll
I am using this board as a keyboard for demo purposes.
Anyways to make the long story short everything works fine except for very few cases. I send keystrokes with the SendInput function located in user32.dll.
So my program looks like:
static void…

Tono Nam
- 34,064
- 78
- 298
- 470
26
votes
2 answers
C# PInvoking user32.dll on a 64 bit system
Is it wrong to pinvoke user32.dll on 64 bit Windows, from a 64 bit app? I've done this successfully a number of times and never had an error, but it seems contradictory. Should I look for user64.dll instead?

James Cadd
- 12,136
- 30
- 85
- 134
20
votes
1 answer
Using SetWindowPos with multiple monitors
Using user32.dll and C# I wrote the method that you see below. Using a process handle for a window, it will set the window position at a provided (x, y) location.
However, in a multi-monitored environment the code below sets the window position to…

sapbucket
- 6,795
- 15
- 57
- 94
18
votes
1 answer
How do I lock a windows workstation programmatically?
Possible Duplicate:
Lock Windows workstation programmatically in C#
I am currently working on a visual studio windows form application that requires a function that locks the workstation. How can i make use of user32.dll to do a lock (Windows +…

Derek
- 239
- 1
- 7
- 15
18
votes
5 answers
How can I be notified when a new window is created on Win32?
Is there a way using Win32, to register for notifications when a new window is created. I'm trying to keep a list of current open windows, but am now just polling the list of current windows using EnumWindows().
Anyone done something…

James Hollister
- 537
- 4
- 9
16
votes
4 answers
Determine if a window is visible or not using C#
I have a Console / Form hybrid application in C#, and at the moment, i have to rely on user32.dll to show/hide the console window. But I can't seem to find a way in which i can determine if the console window is hidden or visible (without storing…

Mike
- 161
- 1
- 1
- 3
15
votes
2 answers
Get text from inside google chrome using my c# app
I am writing a small app that will among other things expand shortcuts into full text while typing.
example:
the user writes "BNN" somewhere and presses the relevant keyboard combination, the app would replace the "BNN" with a "Hi I am…

Banana
- 7,424
- 3
- 22
- 43
12
votes
2 answers
Move window when external application's window moves
I've got an always on-top application (basically a status display) that I want to follow around another program and always sit just to the left of the minimize button.
I can get the Rect representing the "target" process using the following code…

ScottishTapWater
- 3,656
- 4
- 38
- 81
11
votes
3 answers
Directing mouse events [DllImport("user32.dll")] click, double click
I tried
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
and it works pretty fine to move the cursor to the desired point. I have never tried such kind of a DLL import before but it works :). However I want more what else can…

albatross
- 455
- 2
- 8
- 27
11
votes
4 answers
How can I take a window screenshot in Node.js?
I'm in a research to find a way to take a screenshot of a window using Node.js, and I'm trying to do this with node-ffi, but I don't know how... at a time I'm stuck here:
var ffi = require('ffi');
var user32 = new ffi.Library("user32", {
…

Daniel de Andrade Varela
- 823
- 1
- 11
- 25
11
votes
2 answers
Can't import User32.dll into Visual Studio
I tried:
To add user32.dll from Reference Manager, and imported it from Windows\System32\user32.dll, I got Error Message:
A reference to 'C:\Windows\System32\user32.dll couldn't be added.
Please make sure that the file is accessible, and that it is…

jovanMeshkov
- 757
- 5
- 12
- 29
9
votes
1 answer
C# minimized windows not being returned by call to System.Diagnostics.Process.GetProcesses()
I'm attempting to find a minimized window and Show it.
The program can be downloaded from Samsung and it is titled "SideSync". To fully replicate my question you would need to install this and also have a Samsung phone to plug in to your computer.…

sapbucket
- 6,795
- 15
- 57
- 94
9
votes
2 answers
For C#, is there a down-side to using 'string' instead of 'StringBuilder' when calling Win32 functions such as GetWindowText?
Consider these two definitions for GetWindowText. One uses a string for the buffer, the other uses a StringBuilder instead:
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int GetWindowText(IntPtr hWnd,…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
8
votes
4 answers
How to use Win32 GetMonitorInfo() in .NET c#?
I have to implement a feature where the last position of the window is saved. When the application starts up this position needs to be obtained and restored.
Now it could be that a second monitor is dismantled. If the last position is on a now…

Houman
- 64,245
- 87
- 278
- 460
8
votes
1 answer
Unity3d user32.dll drag window and take focus back
I made a borderless windowed application and a "fake" title bar to drag it.
I'm using user32.dll,
This to start the window drag (triggered by unity IBeginDragHandler) :
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int WM_NCLBUTTONUP =…

FLX
- 2,626
- 4
- 26
- 57