user32

WPF Application fixed on Desktop - Opposite of topMost

Is there a possibility to "fix" the WPF application on the desktop (like Win7 Gadgets)? I have found some code which achieves this on Win XP but it is not working on Win7. It uses the user32.dll. public void DockStart() { IntPtr hwndParent = FindWindow("ProgMan", null); HwndSource hwndSource = PresentationSource...

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? ...

How to call user32.dll methods from javascript

Hello all, I have a javascript running on a browser. Is it possible to call a function/method in user32.dll. This is possible from C# by using pInvoke calls. How do I do the same in JavaScript? Thanks, Datte ...

System Wide Shell Hook from .NET using Unmanaged DLL

Hello everyone, I have used the code supplied in the following CodeProject article in the past with success, but it only seems to partially work on Vista/7 (I'm guessing because of UAC). It works for the current thread, but it doesn't pick up system wide activity. I've tried adding requireAdministrator in the manifests and signing both ...

TranslateAccelerator return value

The message loop generated by class wizard often looks like while( GetMessage() ) { if( !TranslateAccelerator() ) { TranslateMessage(); DispatchMessage(); } } Whereas TranslateAccelerator documentation says: If the function succeeds, the return value is nonzero. If the function fails, the return value is z...

An unhandled exception of type 'System.ExecutionEngineException' occurring When trying to read window from GetWindowText() of user32.dll

In my application, I am reading the text of a window for the same process. I am using GetWindowText of User32.dll. But when it tries to call the method, I am getting the exception "An unhandled exception of type 'System.ExecutionEngineException' occurred in aaaa.exe". Where can I see the exact error. And why I am getting this exception. ...

how to handle browser based security issues on invoking Activex components..??

Hi, Update 1: Further investigation reveals that VB Activex component failed to initialize the user32 dll and failed to invoke the ShowWindow method when the browser security trust level is medium. Update 2: I have fixed the issue by just enabling the allow scripting of the webbrowser control option in medium level security. I dont ...

How to control windows application focus in .NET

I'm using pinvoke "user32.dll" to send my application to back (behind all other apps) so it sits on desktop and vice versa. At the moment it just toggles - back/front. Is there a way to detect if my app is at the back and bring it to front or if it's on front and send it to back? THanks. ...

Collect all windows handlers

How do I collect all windows handlers in C#. I need all the windows (not just the parents) Thanks, ...

Why does CreateWindowEx return 0

VB.NET 2008 Express Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Integer, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hwndParent As Integer, ByVal h...

WIn32 Help with SwitchToThisWindow, ShowWindow, and SetActiveWindow

I have a VB 6 MDI application. It responds to the depricated SwitchToThisWindow function, but not the ShowWindow and SetActiveWindow functions. I know ShowWindow and SetActiveWindow are declared correctly because I can use them with any other application. EDIT: My goal isn't to use these functions, it is simple to switch the focus from ...

SetScrollPos: scroll bar moving, but control content not updating

[DllImport("user32.dll")] public static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw); [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetScrollPos(int hWnd, int nBar); So those are the externs im using to move the scroll position, what im doing, is i ge...

WinForms: How to determine if window is no longer active (no child window has focus)?

My application uses multiple windows I want to hide one specific window in case the application loses focus (when the Active Window is not the application window) source I am handling the Deactivate event of my main form. private void MainForm_Deactivate(object sender, EventArgs e) { Console.WriteLine("deactivate"); ...

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 the value myself) ...

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 switched my approach to 2nd method, send message method. see this sample code [DllImp...

Getting mouse events

I'm working in C# and would like to get all the mouse events. What is the best why to do so. I tried: SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0); I couldn't make it to work and it's limited to a single module, and I would like to get all the mouse events. ...

Reset Taskbar Flash in C#

I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below: http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskb...

How to get file name from active text editor using User32 JNI?

How to get file name from active text editor using User32 JNI? example: I'm editing text in some text editor (win32) and I have another java app that needs to know file name (file path) of file that I'm currently editing text in. ...

Is there a native .NET method or equivalent to user32.dll's GetKeyboardState?

ANSWER: There isn't a natively managed equivalent for this method. However, a good example managed code API can be found over at pinvoke.net. Hi all I have an application that accepts a flag for 'trace mode'. Trace mode turns on a form containing a text box. The text box displays output via a custom TraceListener object. If there is a ...

using rundll32 user32.dll to indicate that a user's environment has changed.

I do not have the ability to modify environement variables in windows 7. However I have been granted permission to modify the registry settings. So for example I can modify: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment Key: BPATH which is appended to the end of my System's pathEnv. but when I make ...