user32

Using SendMessage for Simulating User Mouse Clicks

家住魔仙堡 提交于 2019-12-24 11:06:05
问题 I need to use SendMessage fro simulating user clicks in a target program as SendMessage blocks until the event that it triggers is finished processing. The reason for this is that this blocking gives opportunity to detect if any dialogs have opened up as a result of the clicking. My problem currently is that although I can get the click to work using WM_LBUTTONDOWN and WM_LBUTTONUP messages consecutivly on a button in a mocked up form which opens a model dialog, I cannot get it to work on

NoSuchMethodError using JNA User32 platform map

折月煮酒 提交于 2019-12-24 10:24:58
问题 I received the following error on the first attempt of using the User32.Instance: Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library; at com.sun.jna.platform.win32.User32.(User32.java:48) whilst trying to run a JNA pre-defined mapping of the Windows User32 class functions. I tried running the following code: HWND hwnd = User32.INSTANCE.FindWindow(null,"new 2 - Notepad++"); User32.INSTANCE

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

梦想与她 提交于 2019-12-24 03:32:54
问题 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"); if (GetActiveWindow() == this.Handle) { Console.WriteLine("isactive=true"); } else { Console.WriteLine("isactive=false"); } } [DllImport("user32.dll")] static extern IntPtr

Use a window handle as an owner for a VB6 form

别说谁变了你拦得住时间么 提交于 2019-12-23 20:52:01
问题 What is the Win32 equivalant of Form2.Show vbModeless, Form1 that allows me to set the owner (not the parent) to an arbitrary hWnd and set the default position, etc? As far as I'm aware, this can only be set when creating a window. 回答1: I'm not sure what you are trying to accomplish, but I think you might be looking for the SetParent function. Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long hWndChild is the handle to the child window.

How can I retrieve the values from window of class “ThunderRT6ListBox” using user32.dll in c#

与世无争的帅哥 提交于 2019-12-23 02:55:12
问题 I am trying to retrieve information from extern desktop aplication in Windows. I know how extract the text from Textboxes (class "Edit") but I don't know how extract the values from controls with class name "ThunderRT6ListBox" and "ThunderRT6ComboBox". How can I do that? I have this code to extract the text from the textbox: public static class ModApi { [DllImport("user32.dll", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern

Using post/sendmessage to do mouse clicks doesnt work [duplicate]

大憨熊 提交于 2019-12-23 02:40:35
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to simulate Mouse Click in C#? I have tried Window = FindWindow(null, "untitled - Paint"); PostMessage(WindowToFind, WM_MOUSEMOVE, 0, location); PostMessage(WindowToFind, WM_LBUTTONDOWN, ((int)Keys.LButton), location); location is 100 * 0x10000 + 100 for 100x100 etc. I doubt its wrong. I have tried swapping ((int)Keys.LButton) with 0 , didn't work. I tried putting thread.sleep between lbuttondown and

Python ctypes: Prototype with LPCSTR [out] parameter

霸气de小男生 提交于 2019-12-23 01:14:16
问题 I'm currently getting into the ctypes module and I'm trying to call the user32 function GetWindowText with a HWND handle I already received by using FindWindow. This time though i wanted to process a step further and use a function prototype instead of calling the function with ctypes.windll.user32.GetWindowText . Although I´m having problems declaring the lpString arguement as output parameter. My first attempt looked this way: GetWindowText = cfunc("GetWindowTextA",windll.user32,c_int, (

Using SystemParametersInfo from C# (SPI_GETSCREENREADER SPI_SETSCREENREADER)

跟風遠走 提交于 2019-12-21 23:01:33
问题 Am I doing this correctly? [DllImport("user32", CharSet = CharSet.Auto)] internal static extern long SystemParametersInfo(long uAction, int lpvParam, ref bool uParam, int fuWinIni); ... public static bool IsScreenReaderRunning() { long SPI_GETSCREENREADER = 70L; bool bScreenReader = false; long retVal; retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0); //uint iParam = 0; //uint iUpdate = 0; //bool result = false; //bool bReturn = SystemParametersInfo(SPI

WM_GETICON not working (Windows)

被刻印的时光 ゝ 提交于 2019-12-20 05:57:10
问题 If I don't use WM_SETICON first to set the icon then WM_GETICON is always returning 0. This is weird. Please help. This is my code, can copy paste into scratchpad and run. When doing SendMessage(targetWindow_handle, WM_GETICON , ICON_SMALL, ctypes.voidptr_t(0)) , hIconSmall_orig and hIconBig_orig is always returning 0 I have no idea why. IF you go WM_SETICON on the window first then it properly gets the HICON but the whole purpose is to get the default icon. Cu.import('resource://gre/modules

WinAPI MoveWindow function not working for some windows

烈酒焚心 提交于 2019-12-19 11:19:23
问题 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, int nWidth, int nHeight, bool bRepaint); [DllImport("user32.dll", EntryPoint = "SetWindowPos")] public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags); //assorted constants needed public static