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.

547 questions
7
votes
2 answers

DllImport user32 vs user32.dll

What is the difference between the usages of DllImport here? Specifically, does "user32" just mean "user32.dll", or does it mean "user32.lib" or something else? [DllImport("user32")] protected static extern int GetKeyboardState(byte[]…
Kendall Frey
  • 43,130
  • 20
  • 110
  • 148
7
votes
3 answers

Swapping left and right mouse button in .NET

How do I swap left and right mouse buttons in .NET (preferably C#)? Basically the result should be the same as if the user checked the "Switch primary and secondary buttons" checkbox in the Mouse Properties through the control panel. I'm dealing…
Eugene Katz
  • 5,208
  • 7
  • 40
  • 49
7
votes
0 answers

Screenshot in Windows 10 and multiple desktops

I am taking screenshots of Windows desktop with code such as HDC hScreen = GetDC(NULL); HDC hDC = CreateCompatibleDC(hScreen); HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, w, h); HGDIOBJ old_obj = SelectObject(hDC, hBitmap); BOOL …
7
votes
2 answers

How to locate the window using findwindow function in windowapi using vba?

I am currently trying to find a way to check whether a window is open or not using Findwindow Function. I am able to find the window if i know the entire name of the window. In the below code i know that the name of the window is "win32api -…
RAJA THEVAR
  • 421
  • 1
  • 5
  • 19
6
votes
1 answer

Click Button in Toolbar of Other Program

I'm trying to automate some stuff on a legacy application that I don't have the source to. So I'm essentially trying to use the Windows API to click the buttons I'll need on it. There is a toolbar of type msvb_lib_toolbar that looks like this: I…
ScottishTapWater
  • 3,656
  • 4
  • 38
  • 81
6
votes
2 answers

How to get the text of a MessageBox when it has an icon?

I am working on trying to close a specific MessageBox if it shows up based on the caption and text. I have it working when the MessageBox doesn't have an icon. IntPtr handle = FindWindowByCaption(IntPtr.Zero, "Caption"); if (handle == IntPtr.Zero) …
James
  • 523
  • 1
  • 4
  • 20
6
votes
1 answer

WinAPI MoveWindow function not working for some windows

I want to resize and/or move some external windows from my application, mainly the On-Screen keyboardwindow. Here is the code: [DllImport("user32.dll", SetLastError = true)] internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y,…
v.chjen
  • 615
  • 1
  • 8
  • 20
6
votes
3 answers

SHIFT Shortcut being displayed as MAJ for culture "nl-BE" when it should be SHIFT (C#.NET)

After a long discussion with Infragistics it appears that ShortCuts with SHIFT are displayed as MAJ in my culture "nl-BE". First of all, the culture "nl-BE" and AZERTY is somewhat of a strange thing. Read http://en.wikipedia.org/wiki/AZERTY if want…
Lieven Cardoen
  • 25,140
  • 52
  • 153
  • 244
6
votes
3 answers

Changing system colors for a single application (Windows, .NET)

I know I should generally avoid messing up with such system settings, but my application do already use nonstandard colors and I have no influence on that. I would like to be able to add standard .NET controls in some places, but their colors do not…
Michal Czardybon
  • 2,795
  • 4
  • 28
  • 40
5
votes
1 answer

Handling minimized programs

I need help handling minimized programs when using a custom/self made explorer.exe file .. because unless properly handled, minimized programs will just shrink to something like 100x50px and stay on screen. I worked out a Timer in C# to check for…
5
votes
3 answers

How to determine if the Caps Lock is toggled in a Silverlight Application?

In a Silverlight application's log in screen, i need to determine if Caps Lock is toggled. This is easy enough by handling the KeyUp or KeyDown event, however how does one determine if it is toggled on or off even if a key hasn't been pressed? The…
Rogan
  • 225
  • 1
  • 12
5
votes
0 answers

user32 GetSystemMetrics return different values

I'm trying to get the border thickness of a console app. So far, I've got the value from the GetSystemMetrics of the user32 dll with the SM_CXSIZEFRAME/SM_CYSIZEFRAME value. In a winform application, it return the right value (9), however, in a…
Remy Grandin
  • 1,638
  • 1
  • 14
  • 34
5
votes
1 answer

PInvoke PostMessage not working across user accounts

I'm building a kill switch into my application so that only one instance can run at a time on a single computer. I'm accomplishing this by posting messages between the process of the running application and the process of the new instance of the…
flamebaud
  • 978
  • 1
  • 9
  • 26
5
votes
1 answer

Capture Highlighted Text from any window using C#

How to read the highlighted/Selected Text from any window using c#. i tried 2 approaches. Send "^c" whenever user selects some thing. But in this case my clipboard is flooded with lots of unnecessary data. Sometime it copied passwords also. so i…
Dinesh
  • 2,026
  • 7
  • 38
  • 60
5
votes
2 answers

How to know that a dialog box is an alert or confirm or prompt using VB.Net Winform App?

I can get the Window handle using "GetForegroundWindow" of "user32.dll" and by matching its class name with "#32770", I can check that it is a dialog. Now my question is how do I know that this dialog is and alert, confirm or prompt dialog? Please…
user1492859
1
2
3
36 37