Handle windows.h




















Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. What is a Windows Handle? Ask Question. Asked 12 years, 7 months ago. Active 5 years, 3 months ago. Viewed k times. What is a "Handle" when discussing resources in Windows? How do they work?

Improve this question. Al C Al C 4, 6 6 gold badges 37 37 silver badges 64 64 bronze badges. Add a comment. Active Oldest Votes. It's an abstract reference value to a resource, often memory or an open file, or a pipe. Improve this answer. Lawrence Dol Lawrence Dol Is the value of a handle meaningful?

I mean if one handle value less than the other, does it mean the handle was created earlier than the other? No, the value of a handle is not meaningful.

It should be treated as an opaque value. This has a couple of consequences: the user code must have access to the header file that defines the Widget struct the user code could potentially modify internal parts of the returned Widget struct Both of these consequences may be undesirable. Why go through this trouble? Dan Moulding Dan Moulding k 22 22 gold badges 90 90 silver badges 97 97 bronze badges.

This type is declared in IntSafe. An unsigned long type for pointer precision. Use when casting a pointer to a long type to perform pointer arithmetic.

Also commonly used for general bit parameters that have been extended to 64 bits in bit Windows. This type is declared in BaseTsd. A floating-point variable. A handle to an accelerator table.

Half the size of a pointer. A handle to an object. A handle to a dynamic data exchange DDE conversation. This type is declared in Ddeml. A handle to a DDE conversation list.

A handle to DDE data. A handle to an internal drop structure. This type is declared in ShellApi. A handle to a deferred window position structure. This type is declared in WinUser. A handle to a GDI object. A handle to a global memory block. A handle to an instance. This is the base address of the module in memory. A handle to a registry key. An input locale identifier. A handle to a local memory block.

A handle to a module. The is the base address of the module in memory. A handle to a display monitor. A handle to a palette. A handle to a pen. A handle to a resource. A handle to a DDE string. A bit signed integer. The range is through decimal. An 8-bit signed integer. This type is declared in WinNls. If the function fails, the return value is zero.

To get extended error information, call GetLastError. If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function.

Generally, an application should call CloseHandle once for each handle it opens. In this case, the application should close the handle. If a handle is transacted, all handles bound to a transaction should be closed before the transaction is committed. For more information about transacted objects, see Working With Transactions.

Closing a thread handle does not terminate the associated thread or remove the thread object. I know how to use them in a very basic manor. I want more control etc. Thnk you mats i know what they are and your explenation actually gave me a better idea. But i need a book or something. Im sure there ahs to be something out there. Thank you!! Maybe you can explain in more detail what you actually would like to do with a handle and what type of handle it is, that is, what type of object have you created.

In general, windows returns a pointer to some internal data structure when it gives you a handle.



0コメント

  • 1000 / 1000