user32

Make a dropdown type Combobox behave like an Edit control

≡放荡痞女 提交于 2021-01-29 22:24:07
问题 I'm about to replace a standard edit control with a dropdown type combo box. So basically that combobox bahaves like exactly like an edit control. Everything works fine so far but there is just one notable difference: When you click on the edit control containing already some text and that doesn't have the focus, the cursor is simply positioned where you click. But when you click on a the combo box containing already some text and that doesn't have the focus, the whole text is selected. This

Difficulties with p/invoke and EnumDisplaySettingsEx

断了今生、忘了曾经 提交于 2021-01-29 04:25:32
问题 I am attempting to retrieve information on all the various monitors (and their adapters) present on a system. So far, my attempts at using EnumDisplayDevices to list all the monitors has worked great - it found two, the first being "\\.\DISPLAY1\Monitor0" (the second is just 2 and 1, respectively, but it's irrelevant to this question). Anyway, I then attempted to call EnumDisplaySettingsEx on it, passing the name of the monitor as above, but it always fails. Calls with a null name parameter

Difficulties with p/invoke and EnumDisplaySettingsEx

萝らか妹 提交于 2021-01-29 04:20:39
问题 I am attempting to retrieve information on all the various monitors (and their adapters) present on a system. So far, my attempts at using EnumDisplayDevices to list all the monitors has worked great - it found two, the first being "\\.\DISPLAY1\Monitor0" (the second is just 2 and 1, respectively, but it's irrelevant to this question). Anyway, I then attempted to call EnumDisplaySettingsEx on it, passing the name of the monitor as above, but it always fails. Calls with a null name parameter

How can I take a window screenshot in Node.js?

只愿长相守 提交于 2020-04-08 09:49:06
问题 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", { FindWindowA: [ 'uint32' , [ 'string', 'string' ]] , PrintWindow: [ 'int32' , [ 'int32', 'string', 'int32' ]] }); var IMG; var windowHandle = user32.FindWindowA(null, "Calculator"); var printWin = user32.PrintWindow(windowHandle, IMG, 0); console.log(printWin)

private static bool EnumWindow(IntPtr handle, IntPtr pointer) doesn't run

江枫思渺然 提交于 2020-01-25 14:27:22
问题 I have the following code that seems to work on one of my projects but it doesn't work on a different one. Code is exactly the same on both but the method EnumWindow never gets executed. Here is the code: [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern Int32 GetClassName(IntPtr hWnd, StringBuilder StrPtrClassName, Int32 nMaxCount); [System.Runtime.InteropServices.DllImport("user32")] [return: System.Runtime

System Wide Shell Hook from .NET using Unmanaged DLL

余生颓废 提交于 2020-01-14 05:23:40
问题 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 the unmanaged and managed assemblies, and that doesn't appear to help. Using Window Messages to Implement Global System Hooks in C# My main goal is to use SetWindowsHookEx to

GetWindowText() throwing error and not being caught by try/catch

一个人想着一个人 提交于 2020-01-02 05:58:09
问题 When I run the code below for the GetWindowText I get the following error thrown as an inner Exception: {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."} [DllImport("user32.dll", EntryPoint = "GetWindowTextLength", SetLastError = true)] internal static extern int GetWindowTextLength(IntPtr hwnd); [DllImport("user32.dll", EntryPoint = "GetWindowText", SetLastError = true)] internal static extern int GetWindowText(IntPtr hwnd, ref

Can't import User32.dll into Visual Studio

夙愿已清 提交于 2020-01-02 02:19:06
问题 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 a valid assembly or COM component. using System.Runtime.InteropServices; [DllImport("user32")] To launch Visual Studio as Administrator Nothing works... it goes on my nerves I am trying 2 hours to import this damn .dll... 回答1: You do not need to

Alt+key not working with PostMessage(use32.dll)

好久不见. 提交于 2019-12-25 03:48:15
问题 I read this answer Link It is exactly what i tring to do,i need to send postmessage Alt+'E' to winApp but it's not working i used Spy++ and duplicate Wparametr and Lparametr and build it with postmessage. I did the same but i can't get the Alt+E action. Any one know where is my misstake? How to get Alt+E event/action form windows application? Here Spy++ the first 5 rows i pressed and the second is my code.(see the diffrance in Lparametrs and extend and AltDown) In Img you can see that my code

Teamviewer breaks GetWindowRect

六眼飞鱼酱① 提交于 2019-12-24 14:29:37
问题 I'm trying to grab a window by the process name and focus it, then take a screenshot of it. It works perfectly unless I have Teamviewer open (not even while using teamviewer to screenshare, just when teamviewer is running) When teamviewer is running the window isn't focused or brought to the foreground, and the rect it screenshots is very small (33x21) where normally it would be 1600x900. Here is the code in question: proc = Process.GetProcessesByName(procName)[0]; SetForegroundWindow(proc