c# Programming Glossary: user32
Global mouse event handler http://stackoverflow.com/questions/11607133/global-mouse-event-handler flags public uint time public IntPtr dwExtraInfo DllImport user32.dll CharSet CharSet.Auto SetLastError true private static extern.. lpfn IntPtr hMod uint dwThreadId DllImport user32.dll CharSet CharSet.Auto SetLastError true return MarshalAs.. extern bool UnhookWindowsHookEx IntPtr hhk DllImport user32.dll CharSet CharSet.Auto SetLastError true private static extern..
C# - Sending messages to Google Chrome from C# application http://stackoverflow.com/questions/147929/c-sharp-sending-messages-to-google-chrome-from-c-sharp-application I did something similar with WinAmp using DllImport user32 EntryPoint SendMessageA private static extern int SendMessage.. winamp from my C# code. I started by importing DllImport user32.dll CharSet CharSet.Auto public static extern IntPtr FindWindow.. UnmanagedType.LPTStr string lpWindowName DllImport user32.dll CharSet CharSet.Auto static extern int SendMessageA IntPtr..
Send message to a Windows process (not its main window) http://stackoverflow.com/questions/1777668/send-message-to-a-windows-process-not-its-main-window int WM_MY_MSG RegisterWindowMessage WM_MY_MSG DllImport user32 private static extern bool PostMessage IntPtr hwnd int msg IntPtr.. IntPtr hwnd int msg IntPtr wparam IntPtr lparam DllImport user32 private static extern int RegisterWindowMessage string message..
How can I get functionality similar to Spy++ in my C# app? http://stackoverflow.com/questions/1967604/how-can-i-get-functionality-similar-to-spy-in-my-c-sharp-app int EnumWindowsProc IntPtr hwnd int lParam DllImport user32.Dll private static extern int EnumWindows EnumWindowsProc x.. extern int EnumWindows EnumWindowsProc x int y DllImport user32 private static extern bool EnumChildWindows IntPtr window EnumWindowsProc.. window EnumWindowsProc callback int lParam DllImport user32.dll public static extern int GetWindowThreadProcessId IntPtr..
How do I backup and restore the system clipboard in C#? http://stackoverflow.com/questions/2578900/how-do-i-backup-and-restore-the-system-clipboard-in-c system clipboard did. I looked into some of the low level user32 calls like OpenClipboard EmptyClipboard and CloseClipboard hoping..
Global Hook Keylogger problem http://stackoverflow.com/questions/3540572/global-hook-keylogger-problem extern IntPtr LoadLibrary string lpFileName DllImport user32.dll CharSet CharSet.Auto CallingConvention CallingConvention.StdCall.. callback IntPtr hInstance uint threadID DllImport user32.dll CharSet CharSet.Auto CallingConvention CallingConvention.StdCall.. bool UnhookWindowsHookEx IntPtr hookHandle DllImport user32.dll CharSet CharSet.Auto CallingConvention CallingConvention.StdCall..
Global hotkey in console application http://stackoverflow.com/questions/3654787/global-hotkey-in-console-application false private const int WM_HOTKEY 0x312 DllImport user32 SetLastError true private static extern bool RegisterHotKey.. IntPtr hWnd int id uint fsModifiers uint vk DllImport user32 SetLastError true private static extern bool UnregisterHotKey..
Get active window text (and send more text to it) http://stackoverflow.com/questions/479548/get-active-window-text-and-send-more-text-to-it text at all. Here's an example of what I've done DllImport user32.dll private static extern bool UnregisterHotKey IntPtr hWnd.. extern bool UnregisterHotKey IntPtr hWnd int id DllImport user32.dll static extern int GetForegroundWindow DllImport user32.dll.. user32.dll static extern int GetForegroundWindow DllImport user32.dll static extern int GetWindowText int hWnd StringBuilder text..
Log off user from Win XP programmatically in C# http://stackoverflow.com/questions/484278/log-off-user-from-win-xp-programmatically-in-c-sharp P Invoke ExitWindowsEx http www.pinvoke.net default.aspx user32 ExitWindowsEx.html Pulling it all together using System.Runtime.InteropServices.. System.Runtime.InteropServices class Class1 DllImport user32.dll static extern bool ExitWindowsEx uint uFlags uint dwReason..
How do I suspend painting for a control and its children? http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children how to use this message class DrawingControl DllImport user32.dll public static extern int SendMessage IntPtr hWnd Int32 wMsg.. is similar example in VB Declare Function SendMessage Lib user32 Alias SendMessageA ByVal hWnd As Integer _ ByVal wMsg As..
Hosting external app in WPF window http://stackoverflow.com/questions/5028598/hosting-external-app-in-wpf-window external app a child window using Get SetWindowLong from user32.dll to set GWL_STYLE as WS_CHILD . But if I do that the menu.. windowsFormsHost1.Child _panel DllImport user32.dll private static extern int SetWindowLong IntPtr hWnd int.. IntPtr hWnd int nIndex int dwNewLong DllImport user32.dll SetLastError true private static extern int GetWindowLong..
Why is EnumChildWindows skipping children? http://stackoverflow.com/questions/7014190/why-is-enumchildwindows-skipping-children bool EnumWindowProc IntPtr hWnd IntPtr parameter DllImport user32 return MarshalAs UnmanagedType.Bool public static extern bool..
C# Console App + Event Handling http://stackoverflow.com/questions/764869/c-sharp-console-app-event-handling Or you could write the message pump by hand using user32 GetMessage DispatchMessage. But it's probably easier to use.. or WPF. What the basic structure of a program that uses user32 GetMessage user32 DispatchMessage c# event handling console.. basic structure of a program that uses user32 GetMessage user32 DispatchMessage c# event handling console application share..
Drawing a transparent button http://stackoverflow.com/questions/1086621/drawing-a-transparent-button share improve this question WinForms and underlying User32 does not support transparency at all. WinForms however can simulate..
Saving a screenshot of a window using C#, WPF, and DWM http://stackoverflow.com/questions/1858122/saving-a-screenshot-of-a-window-using-c-wpf-and-dwm public static Image CaptureScreen return CaptureWindow User32.GetDesktopWindow public static Image CaptureWindow IntPtr handle.. static Image CaptureWindow IntPtr handle IntPtr hdcSrc User32.GetWindowDC handle RECT windowRect new RECT User32.GetWindowRect.. hdcSrc User32.GetWindowDC handle RECT windowRect new RECT User32.GetWindowRect handle ref windowRect int width windowRect.right..
WebBrowser.DrawToBitmap() or other methods? http://stackoverflow.com/questions/2434156/webbrowser-drawtobitmap-or-other-methods public static Image CaptureScreen return CaptureWindow User32.GetDesktopWindow public static Image CaptureWindow IntPtr handle.. static Image CaptureWindow IntPtr handle IntPtr hdcSrc User32.GetWindowDC handle RECT windowRect new RECT User32.GetWindowRect.. hdcSrc User32.GetWindowDC handle RECT windowRect new RECT User32.GetWindowRect handle ref windowRect int width windowRect.right..
.NET sendkeys to calculator http://stackoverflow.com/questions/2604898/net-sendkeys-to-calculator string lpClassName string lpWindowName DllImport User32 public static extern bool SetForegroundWindow IntPtr hWnd private..
How to take a screenshot of a Full Size window in C# http://stackoverflow.com/questions/4176340/how-to-take-a-screenshot-of-a-full-size-window-in-c-sharp returns private Image CaptureDesktop return CaptureWindow User32.GetDesktopWindow public Image CaptureAciveWindow return CaptureWindow.. public Image CaptureAciveWindow return CaptureWindow User32.GetForegroundWindow summary An Internal method that captures.. handle get te hDC of the target window IntPtr hdcSrc User32.GetWindowDC handle get the size User32.RECT windowRect new User32.RECT..
C# Force Form Focus http://stackoverflow.com/questions/46030/c-sharp-force-form-focus extern bool SetForegroundWindow IntPtr hWnd DllImport User32.dll EntryPoint ShowWindowAsync private static extern bool ShowWindowAsync.. Sets the window to be foreground DllImport User32 private static extern int SetForegroundWindow IntPtr hwnd Activate.. hwnd Activate or minimize a window DllImportAttribute User32.DLL private static extern bool ShowWindow IntPtr hWnd int nCmdShow..
Why do UI Controls in WPF have Thread Affinity? http://stackoverflow.com/questions/8733303/why-do-ui-controls-in-wpf-have-thread-affinity WPF ™s threading model was kept in sync with the existing User32 threading model of single threaded execution with thread affinity... Win32 message pump in fact the WPF dispatcher uses User32 messages for performing cross thread calls. There are really.. WPF ™s threading model was kept in sync with the existing User32 threading model of single threaded execution with thread affinity...
How to set focus back to form after opening up a process (Notepad)? http://stackoverflow.com/questions/8881038/how-to-set-focus-back-to-form-after-opening-up-a-process-notepad SetFocus new HandleRef null hWnd DllImport User32 private static extern int SetForegroundWindow IntPtr hwnd DllImportAttribute.. int SetForegroundWindow IntPtr hwnd DllImportAttribute User32.DLL private static extern bool ShowWindow IntPtr hWnd int nCmdShow..
Get a screenshot of a specific application [duplicate] http://stackoverflow.com/questions/891345/get-a-screenshot-of-a-specific-application proc Process.GetProcessesByName procName 0 var rect new User32.Rect User32.GetWindowRect proc.MainWindowHandle ref rect int.. procName 0 var rect new User32.Rect User32.GetWindowRect proc.MainWindowHandle ref rect int width rect.right.. bmp.Save c tmp test.png ImageFormat.Png private class User32 StructLayout LayoutKind.Sequential public struct Rect public..
CallbackOnCollectedDelegate in globalKeyboardHook was detected http://stackoverflow.com/questions/9957544/callbackoncollecteddelegate-in-globalkeyboardhook-was-detected unhook public void hook IntPtr hInstance LoadLibrary User32 hhook SetWindowsHookEx WH_KEYBOARD_LL hookProc hInstance 0.. Can't hook more than once IntPtr hInstance LoadLibrary User32 callbackDelegate new keyboardHookProc hookProc hhook SetWindowsHookEx..
|