handle

How to use Control.FromHandle?

Hello there, i saw a method called Control.FromHandle wich (should) give you the access to it. Now, i wanted to try it using this code [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); // Find window by Caption only. Note you must pass IntPtr.Zero as the...

What happens to open handles when an application crashes? (Windows XP onwards)

I was under the impression that if an application has an open handle and it crashes, the handle isn't released and if you try to access that handle (let's say of a file) then you would get an error. However, I have tried this in Windows XP onwards and the handle seems to get released if I close the exe from task manager, before it has c...

Select which handles are inherited by child process.

When creating a child process in C++ using Windows API, one can allow inheritance of handles from parent to child. In a Microsoft example "Creating a Child Process with Redirected Input and Output", redirecting a child process' std in/out to pipes created by the parent, it is necessary to allow inheritance for the redirection pipes to be...

DoDragDrop - get target window handle

I'm using the following code to drag&drop data from listbox into other applications: Dim data As New DataObject(DataFormats.UnicodeText, ListBox1.Text) ListBox1.DoDragDrop(data, DragDropEffects.Copy Or DragDropEffects.Copy) How can I get a handle of the window that receives the data? I'm looking to build something like "Finder...

What are event handles?

I had a leaking handle problem ("Not enough quota available to process this command.") in some inherited C# winforms code, so I went and used Sysinternals' Handle tool to track it down. Turns out it was Event Handles that were leaking, so I tried googled it (took a couple tries to find a query that didn't return "Did you mean: event han...

How can I tell how much memory a handle object uses in matlab

If I delcare an object to be a subclass of handle classdef obj < handle my object is now essentially a "pointer" to some memory somewhere. How do I find out how much memory my object is using up? For example, say I have a class foo with a field bar classdef foo < handle properties bar = randn(1000); end bar takes up 8 megabytes...

Get window handle of calling window

Hello, there is a software which calls a method in my C# dll. In this dll method i need to have the window handle of the program/window which called my dll. how to get this "calling window handle"? Thanks! ...

Replacing a window's control with another at runtime

I've got a handle to a window and its richEdit control. Would I be able to replace the said control with one of my own ? I'd like it to behave as the original one would, i.e., be a part of the window and suchlike. I'll elaborate the scenario further - I'm currently disassembling an application one of whose features is a text editor. My ...

Can "\Device\NamedPipe\\Win32Pipes" handles cause "Too many open files" error?

Continuing from this question: When I am trying to do fopen on Windows, I get a "Too many open files" error. I tried to analyze, how many open files I have, and seems like not too much. But when I executed Process Explorer, I noticed that I have many open handles with similar names: "\Device\NamedPipe\Win32Pipes.00000590.000000e2", "\...

Convert an IntPtr window handle to IWin32Window^

How do I convert a handle acquired from a form/control's Handle property, to a IWin32Window^ ? ...

GDI handles in a DotNET application

My pure DotNET library runs as a plugin inside an unmanaged desktop application. I've been getting a steady (though low) stream of crash reports that seem to indicate a problem with GDI handles (fonts in error messages etc. revert to the system font, display of all sorts of controls break down, massive crash shortly after). My Forms hav...

Displaying Video using a Window Handle

I'm working on a C# wrapper for Dallmeier camera's and currently have a working wrapper. I can connect to a camera via passing the window handle (in my application its a picture box handle), this is used to send video and messages. Once connected I can then send the StartLiveView command and then a live stream video will be shown in the...

lseek/write suddenly returns -1 with errno = 9 (Bad file descriptor)

My application uses lseek() to seek the desired position to write data. The file is successfully opened using open() and my application was able to use lseek() and write() lots of times. At a given time, for some users and not easily reproducable, lseek() returns -1 with an errno of 9. File is not closed before this and the filehandle (...

Can Windows handle inheritance cross the 32-bit/64-bit boundary?

Is it possible for a child process to inherit a handle from its parent process if one process is 32-bit and the other is 64-bit? HANDLE is a 64 bit type on Win64 and a 32 bit type on Win32, which suggests that even it were supposed to be possible in all cases, there would be some cases where it would fail: a 64-bit parent process, a 32-...

How to append text to a text file in WinAPI?

Hi guys, Ive got an annoying problem, I cant append any text to the text file. Every time I open it for writing, I overwrite the data. I tried to move the file pointer to the end of the file, but no result (no writing to the file at all). Here is the code: INVOKE CreateFile, offset filePath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_AL...

How can I access/move handles of a dijit.slider or Dojox.RangeSlider on external input

Introduction: I have a dojox HorizontalRangeSlider UI component. On each side of this control I have a texbox displaying the value of the respective sliders. Problem: When I enter a new value in my textbox I can update the internal value of the RangeSlider but the handles do not respond to the change. How can I achieve this? ...

ThreadPool.QueueUserWorkItem new Form CreateHandle Deadlock

I have a thread that needs to create a popup Window. I start the thread using ThreadPool.QueueUserWorkItem(new WaitCallback(CreatePopupinThread)) Thew thread creats a new form. The application freases in the new Form constructor at CreateHandle. The Worker Thread is locked... How can I fix this? this is how I create the form var form ...

How to handle a webview dialog popup?

I'm displaying a webpage in a WebView and on the webpage, there is a button. When you click the button, a confirmation dialog is supposed to popup, but it doesn't show in my WebView. It does popup if I go to the same webpage in the android browser. Anyone know how to handle popup dialogs coming from a webpage inside your WebView? bro...

How can I tell if a given hWnd is still valid?

Please forgive my ignorance, I'm completely new when it comes to winforms programming. I'm using a third-party class that spawns an instance of Internet Explorer. This class has a property, hWnd, that returns the hWnd of the process. Later on down the line, I may want to reuse the instance of the application if it still exists, so I ne...

Creating a handle to a class' property

Would it be possible to create a handle ( or a tracking handle ) to a class' property ? For instance, System::Windows::Forms::CheckBox^ Box = gcnew System::Windows::Forms::CheckBox() I'd like to create a handle to Box's Checked property and use it to access and modify the same. ...