handle

using constrained execute regions

感情迁移 提交于 2019-12-12 13:38:36
问题 I have a Visual Studio 2008 C# .NET 3.5 application that P/Invokes a native method that accepts a file handle as a parameter. Originally, I was just using FileStream.SafeFileHandle.DangerousGetHandle() to get the file handle. But, after turning on FX COP, I got a CA2001 warning about that. So, after a little research I discovered "Constrained execute regions". This is new to me and I haven't seen a whole lot of information about it. I was hoping somebody more experienced could take a look and

Handle object in c++

谁说胖子不能爱 提交于 2019-12-12 12:32:50
问题 I've been told that a handle is a sort of "void" pointer. But what exactly does "void pointer" mean and what is its purpose. Also, what does "somehandle = GetStdHandle(STD_INPUT_HANDLE); do? 回答1: A handle in the general sense is an opaque value that uniquely identifies an object. In this context, "opaque" means that the entity distributing the handle (e.g. the window manager) knows how handles map to objects but the entities which use the handle (e.g. your code) do not. This is done so that

Get path that file explorer is displaying using its window handle

旧街凉风 提交于 2019-12-12 10:11:03
问题 I've succesfully obtained the handle to the current File Explorer window using 'Get handle to active window Dim hWnd As IntPtr = GetForegroundWindow() I have not been succesful finding the object that contains the path the aforementioned window is displaying. This path is supposed to reside in the process of the window, obtained too by Dim ProcessID As UInt32 = Nothing Dim ptr As UInt32 = GetWindowThreadProcessId(hWnd, ProcessID) Dim Proc As Process = Process.GetProcessById(ProcessID) However

Python: win32gui.SetForegroundWindow

天大地大妈咪最大 提交于 2019-12-12 09:18:05
问题 I have just written simple script to launch an applciation and I am trying to use "SendKeys" module to send keystrokes to this application. There is one "Snapshot" button, but I cant get Python to click "Snapshot" button, as the new window is not in focus. So I am planning to use Win32gui module's win32gui.FindWindow and win32gui.SetForegroundWindow functionality. But it gives me error- invalid handle . My app name is "DMCap" Here is code snippet in Python: handle = win32gui.FindWindow(0,

Do I need a WOW64 dump for GDI Handle analysis?

邮差的信 提交于 2019-12-12 08:38:42
问题 I'm debugging a potential GDI Handle Leak. Thanks to @Alois Kraus, there is a WinDbg script which performs a handle count. From my debugging sessions, especially for .NET, I find that usually, it's better to have 32-bit dumps of 32-bit processes and 64-bit dumps of 64-bit processes. Unfortunately, with 2 crash dumps I received, the script does not work. Looking deeper into it, I found out that the GdiSharedHandleTable is null in those dumps: 0:000> dt ntdll!_PEB GdiSharedHandleTable @$peb

C#: ToolStripDropDown doesn't Dispose/DestroyHandle

风流意气都作罢 提交于 2019-12-12 04:29:04
问题 I'm using the ToolStripDropDown to show up an selectionpopup. The ToolStripDropDown contains a few custom controls with running Threads. The Threads ends with the OnHandleDestroyed event, but for some reason the ToolStripDropDown doesn't dispose/destroy it's handle after closing. Disposing the ToolStripDropDown on the closed-event gives me an exception because anything still accesses the ToolStripDropDown. How do I know if the custom Control is still in use or not to end the thread? Custom

Need help getting child windows

☆樱花仙子☆ 提交于 2019-12-12 02:45:24
问题 I am working in vb with visual studio 2010. The app AnyOrder is no longer supported and I am trying to make an app where our users can type in info and then have the info populate into AnyOrder (and also other sites - they have to populate a lot of redundant info) but I am having no luck at all getting the child windows of any order to populate once the data is in the VB window app. I can get the parent window handle just fine but can't seem to get a child window handle to save my life. I can

Haskell concurrency and Handles

不打扰是莪最后的温柔 提交于 2019-12-11 15:16:13
问题 I'm writing a little notification server to push data to a client. The basic architecture looks something like this (pared down pseudo-code): acceptConnections sock = forever $ do connection <- accept sock forkIO (handleConnection connection) handleConnection connection = do connectionHandle <- socketToHandle connection ReadWriteMode handleMessage connectionHandle hClose connectionHandle handleMessage connectionHandle = forever $ do message <- hGetLine connectionHandle if shouldPushMessage

How to dump output of Sysninternals handle.exe to a text file?

冷暖自知 提交于 2019-12-11 14:28:06
问题 I want to see who locks a file, quickly. So I created a CMD script that will run Handle, put its output in a file and then open that file in the default text editor. prompt $ cls handle > handle.txt handle.txt When I run the script a new console wnd is open, I see handle running in it, then it quickly closes. It generates a file called handle.txt, but it is empty. I tried to run handle.exe as admin, but still doesn't work. What I do wrong? 来源: https://stackoverflow.com/questions/30504972/how

WinForms too many handles

别说谁变了你拦得住时间么 提交于 2019-12-11 14:26:13
问题 I our production, my application caused two different exceptions: System.ArgumentException: Invalid Parameter. at System.Drawing.Image.get_RawFormat() at System.Windows.Forms.ToolStripItem.set_Image(Image value) at Zeiss.IMT.IME.CmmUI.Tools.ToolControl.updateControls() There is another exception that i suppose to have the same cause: System.ComponentModel.Win32Exception: The operation completed successfully at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal,