Questions tagged [hwnd]

The Microsoft Windows operating environment identifies each form in an application by assigning it a handle, or hWnd. The hWnd property is used with Windows API calls. Many Windows operating environment functions require the hWnd of the active window as an argument.

In computer programming, a handle is an abstract reference to a resource. Handles are used when application software references blocks of memory or objects managed by another system, such as a database or an operating system.

While a pointer literally contains the address of the item to which it refers, a handle is an abstraction of a reference which is managed externally; its opacity allows the referent to be relocated in memory by the system without invalidating the handle, which is impossible with pointers. The extra layer of indirection also increases the control the managing system has over operations performed on the referent. Typically the handle is an index or a pointer into a global array of tombstones.

Handles were a popular solution to memory management in operating systems of the 1980s, such as Mac OS and Windows. Unix file descriptors are essentially handles. Like other desktop environments, the Windows API heavily uses handles to represent objects in the system and to provide a communication pathway between the operating system and user space. For example, a window on the desktop is represented by a handle of type HWND (handle, window).

Doubly indirect handles have fallen out of favour in recent times, as increases in available memory and improved virtual memory algorithms have made the use of the simpler pointer more attractive. However, many operating systems still apply the term to pointers to opaque, "private" data structures—opaque pointers—or to indexes into internal arrays passed from one process to its client.

A handle leak is a type of software bug that occurs when a computer program asks for a handle to a resource but does not free the handle when it is no longer used.

Wikipedia Article

397 questions
0
votes
0 answers

Output an int array using hwnd window in c++

I recently created 2048 as console app using c++, now I was wondering if I could make it a bit more....prettier. So I'm checking out Windows programming with c++ over on msdn and just wanted to ask is it possible to output a single array element in…
anteAdamovic
  • 1,462
  • 12
  • 23
0
votes
1 answer

How to get a window handle of GTK# widget or container?

I use libvlc_media_player_set_hwnd() function in GTK# (Xamarin). But I can't get a HWND of GTK# widget and set it in libvlc_media_player_set_hwnd() function. In GTK+ I can use gdk_x11_drawable_get_xid(), but I haven't found this function in GTK#. So…
konstantin_doncov
  • 2,725
  • 4
  • 40
  • 100
0
votes
0 answers

How to Get Tooltip of a Window From Window Handle?

I wrote a C++ win32 utility to read the title of open windows of a particular process. The intention is to check if that particular process is active, and if active determine which file is open in it. One way I can determine the open file is by…
unni
  • 183
  • 2
  • 9
0
votes
1 answer

Find hwnd information in a user mode dump in windbg

I am trying to solve one of my applications crashes and top of the call stack looks like this 0012f480 7739b6e3 0002051e 0000001f 00000000 +0x172b6 0012f4ac 7739b874 15b772b6 0002051e 0000001f…
user2800803
  • 65
  • 1
  • 9
0
votes
1 answer

CreateWindow argument type error

I am just starting to play around with C++ and creating windows(On windows). I am using the CreateWindow function and I am getting the error Error 2 error C2664: 'HWND…
Noah Huppert
  • 4,028
  • 6
  • 36
  • 58
0
votes
1 answer

GetProcessId failed with error 6: The handle is invalid

I posted a little earlier with a sendmessage issue and we came to the conclusion that it would be extremely hard to get the chat window from Xchat. I have now moved to ThrashIRC and using spy++ was able to find the chat window(highlighted): As you…
justauser
  • 37
  • 1
  • 9
0
votes
1 answer

Action is performed only after returning from function

I got a little problem that i have some code written in a function that should display some pictures on a board, and i can see the pictures only after the whole function finishes. Here it is: (in the following code, pictures is an array of…
Alaa M.
  • 4,961
  • 10
  • 54
  • 95
0
votes
1 answer

Intellisense: argument of type "HWND" is incompatible with parameter of type "rawData::HWND"

I have been improving a class that I have been working on and one of those things is creating libraries to handle certain tasks that are not really needed to be seen in my main project. However when I call the class and instantiate the library I…
Manuel Mangual
  • 75
  • 1
  • 3
  • 13
0
votes
1 answer

How would i make another application's child window into a tab? (C#)

For instance, I have an application that has a main window and then child windows inside of it. http://screenshots.rd.to/sn/e3hek/sapienfullwindow.png http://screenshots.rd.to/sn/e3hek/appscreen8.png What i need is to grab each individual child…
E3pO
  • 1
  • 2
0
votes
0 answers

In java how to get hwnd for a gui component,not a jframe

I am using java swing to work on a video player' GUI,but my app needs to call a dll and pass a hwnd to the dll, the dll will draw video frame on the swing component . I know how to do this if the swing component is JFrame, JNA works fine. My…
0
votes
0 answers

How do I get a HWND to the instance of Visual Studio that is used to debug the programme it has just generated? c++

I am trying to get the HWND to the instance of Visual Studio that I am currently using to debug my programme but I am a little lost as to how exactly I go about doing that. Do I need to search all the Windows that currently open and then select the…
Lsakurifaisu
  • 133
  • 1
  • 12
0
votes
1 answer

Get HWND of containing IE window from toolbar

I'm developing a toolbar for IE, and I need my toolbar to be able to get the HWND of the containing IE window. It needs to be accurate so that multiple tabs in the same window will all return the same HWND, but different from another IE window. What…
directedition
  • 11,145
  • 18
  • 58
  • 79
0
votes
1 answer

How can I use a WindowsFormApplication button to toggle between two Windows applications (force them to top)?

I have the following objective: Create a windows button that a) on a click switches its label and enforces a running windows application (e.g., Calculator) to the front and b) on a subsequent click changes its label back to the original state and…
MichaelK
  • 95
  • 1
  • 2
  • 8
0
votes
1 answer

WndProc() is not getting the messages I sent to it

I made a project that creates a DLL. This project uses the WFS methods and they access some hardware (devices) to get information or execute some commands. In my project, I first open these devices then register them, I later use other methods to…
M.H.
  • 223
  • 3
  • 10
  • 23
0
votes
1 answer

Windows Hwnd Handle Choose File

I have a web app that successfully gets to a page and clicks an "Upload File" button. My app also successfully handles pop-up windows by monitoring and hooking them. For the most part, it's just to click "OK" or "Cancel" buttons. Buttons are…
Suamere
  • 5,691
  • 2
  • 44
  • 58