handle

Standardized Error Classification & Handling

I need to standardize on how I classify and handle errors/exceptions 'gracefully'. I currently use a process by which I report the errors to a function passing an error-number, severity-code, location-info and extra-info-string. This function returns boolean true if the error is fatal and the app should die, false otherwise. As part of ...

How do you obtain Current Window Handle Count and Window Handle Limit in .NET?

I want to obtain the current number of window handles and the system-wide window handle limit in C#. How do I go about this? ...

File handler's limit crossing 256

Hi, My code opens more than 256 file handles, So When I run it on solaris machines I am ending up in "Exceeding file handlers limit" error. I have two questions regarding this 1) Is this limit is only for 32 bit softwares or 64 bit softwares also suffer from it. I googled about it and came to know that 64 bit softwares do not have thi...

Handle for ShellExecute() - Parent Window???

I am trying to use ShellExecute to open a file in Excel. I was reading about the function on MSDN forums, and I found the folowing information about the handle, which is the first parameter: "hwnd [in] A handle to the owner window used for displaying a user interface (UI) or error messages. This value can be NULL if the operation is no...

LPHANDLE vs. HANDLE

While browsing some code I found a call to OpenPrinter(). The code compiles and works fine. But, we are passing a HANDLE instead of LPHANDLE (as specified in MSDN). I found out that in windef.h the following declaration exists: typedef HANDLE FAR *LPHANDLE; What does LP stand for? Should I use a LPHANDLE, or keep HANDLE? ...

How do I find the handle owner from a hang dump using windbg?

How do I find out which thread is the owner of my Event handle in windbg: I'm running !handle 00003aec f and get Handle 00003aec Type Event Attributes 0 GrantedAccess 0x1f0003: Delete,ReadControl,WriteDac,WriteOwner,Synch QueryState,ModifyState HandleCount 2 PointerCount 4 Name <none> ...

Delphi: Check whether file is in use

I want to write to/delete a file but sometimes I get a crash if the file is in use by another program. How do I check to see whether the file is opened by another process or I can open it for writing? ...

C# compile error: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created."

I just posted a question about how to get a delegate to update a textbox on another form. Just when I thought I had the answer using Invoke...this happens. Here is my code: Main Form Code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using Syst...

Detect file handle leaks in python?

My program appears to be leaking file handles, how can I find out where? - My program uses file handles in a few different places - output from child processes, call ctypes api (imagemagick) opens files, and they are copied. It crashes in shutil.copyfile, but I'm pretty sure this is not the place it is leaking Traceback (most recent c...

Getting a handle to controls in Internet explorer web pages

I have an Internet Explorer browser embedded in a Windows forms application and do not have the ability to modify the source code of this form. However, I have gotten a handle to the IE window and can perform various SendInput functions. If I click on a control how can I tell if it was a TextBox, and then how do I send characters to th...

Drag/Size Handle implementation

I'm looking for drag/size handle implementations or explanations. Perhaps I'm using the wrong nomenclature, but I mean the "handles" that appear around an object (mostly in drawing programs) when you select it and want to perform an operation on that object such as rotate, size, scale, etc... Can anyone point me to an OSS implementatio...

How to get the Handle of the form with get{set?

Hello, I'd like to get the handle of my form from a different class(probably thread). I want to do it the way I do invoke public int GetHandle { get { if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { return this.Handle.To...

Get Application's Window Handles

Hello Guys, I'm bulding an app that given another app mainWindowhandle it collects information about the window state, I've no problem collecting information about child windows but, I can not access the other open windows of an application or even the menus... Is there any way of getting all window handles of an application ? Any ideas...

Need IntPtr for a Form (VB.Net)

I need the intPtr for a form. Control.FromHandle(control) gives me the control from a handle, but I need the opposite--get the handle from a control. How do I do this? ...

Distinguishing a pipe from a file in windows

On Unix, everything is a file, so you can use file i/o functions with pipes, files, sockets, etc. But on windows, the api you use depends on the type of i/o HANDLE you have. My question is: given a HANDLE how do you determine what the underlying type is? For example, I have a HANDLE that's either real file, or a named/anonymous pipe. ...

How to obtain Handle.ToInt32() in an ASP.NET web application

I am trying to learn and use an SDK for a vendor's product. Unfortunately, the documentation is sketchy and I've run into a void in my own knowledge of the .Net Framework. I have some working code for a windows forms application and I am trying to get it working in an ASP.NET web form app. The vendor documentation implies you can do thi...

Determine path to registry key from HKEY handle in C++

Given a handle to a Windows Registry Key, such as the ones that are set by ::RegOpenKeyEx(), is it possible to determine the full path to that key? I realize that in a simple application all you have to do is look up 5 or 10 lines and read... but in a complex app like the one I'm debugging, the key I'm interested in can be opened from a...

Detect empty buffer on a windows handle without using readfile()

I was wondering if there was any function along the lines of IsBufferEmpty() to use on a synchronous handle rather than using ReadFile() and waiting for it to return false. I need something to eliminate the delay that ReadFile() takes to try to read data. ...

wxPython won't close Frame with a parent who is a window handle

I have a program in Python that gets a window handle via COM from another program (think of the Python program as an addin) I set this window to be the main Python frame's parent so that if the other program minimizes, the python frame will too. The problem is when I go to exit, and try to close or destroy the main frame, the frame.clos...

Preventing file handle inheritance in multiprocessing lib

Using multiprocessing on windows it appears that any open file handles are inherited by spawned processes. This has the unpleasant side effect of locking them. I'm interested in either: 1) Preventing the inheritance 2) A way to release the file from the spawned process Consider the following code which works fine on OSX, but crashes o...