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
1 answer

AWT Panel not getting rendered in JFX

I want to add a java.awt.Panel to my JavaFX8 application. Unfortunately it seems that the Panel doesn't get rendered when attached to a SwingNode. I have a simple testapplication: import java.awt.Dimension; import…
Rikan
  • 155
  • 9
0
votes
1 answer

JNA Win32 Get the title of JInternalFrame

I´l dealing with JNA and trying to get the title of a JInternalFrame that is inside a JDialog. I can get all the Windows Programns Titles by using JNA, but the JInternalFrame´s title does not apear in the list. I´m doing something like…
IOSJR
  • 31
  • 2
  • 8
0
votes
1 answer

C++ SFML Draw to other window

I know how to draw text to window created with sf::RenderWindow(); but I need to draw text to already existing game window. It makes it go black, I don't want to erase whole window, just update text on it. Code: #include #include…
daavid245
  • 1
  • 1
0
votes
2 answers

Using HWND to switch window

I wanted to build a program, which changes the active window, so I did some research and found "HWND". I built a small Program to test it. void main() { HWND hWnd = FindWindow(NULL, L"Rechner"); SetForegroundWindow(hWnd); } But,I keep…
FaNaTic
  • 11
  • 2
0
votes
1 answer

Get IDropTarget with HWND throw 0xC0000005 access violation

I'm trying to simulate Drag and Drop to drop a file in another application by C++ code (or .NET) with IDropTarget interface. I have read and tested different solutions. I have a little code to drop a file that work with the mouse. But this code…
ludo
  • 1
  • 3
0
votes
2 answers

"hInstance" is undefined. c++ WIN32 APP

Win32 application. In the MyRegisterClass the wc.hInsance = hInstance.Apparently "hInstane is a undefined idetifier. Why's that ? Im using Visual Studio 2013 and im following Jonathan S Harbours book about Game Programming. Code. include…
Tarmiac
  • 846
  • 1
  • 8
  • 14
0
votes
1 answer

Is HWND value is constant for a file/application?

I want to know that ,hwnd value of a file or application is constant through the life time or it can vary for a file or application after close?
0
votes
1 answer

how to get text from a window with specific HWND?

I'm new to win32 programming and haven't worked around with cpp for a long time. What I intend to do is to get a window's HWND via spy++, and get the text of this window. The problem is that I don't know how to create a HWND object, could anyone…
Judking
  • 6,111
  • 11
  • 55
  • 84
0
votes
1 answer

Drawing problem does ShowWindow(hWnd, SW_HIDE) automatically invalidate rectangles?

I'm running into a problem where, I have a Window that contains a child window. The child window contains another child window where a video is playing using Windows Media Player. Whenever I do call ShowWindow (hWnd, SW_HIDE) on the parent Window…
wk1989
  • 611
  • 1
  • 8
  • 19
0
votes
1 answer

Can I know if my window handle is requested by another process?

There are notifications for this kind of events? Or even for any function using my handle.
dani2810
  • 3
  • 4
0
votes
4 answers

Identify process/exe which was passed specific command line arguments

There are two exes/programs which perform tasks based on command line arguments, let's call it Profile. Users can run multiple instances of these exes with specific Profiles. We have come to a situation that if one exe is running with a profile, the…
bjan
  • 2,000
  • 7
  • 32
  • 64
0
votes
1 answer

C# Pinvoke can't find the Hwnd of Controls after List count was 0 at first time

I'm trying to click a Button in another Application (started from my Programm with Process.Start) The problem: I need to wait until the Loading screen is disappeared and the GUI pop's up... My idea was to read all (Hwnd)Controls until a specific…
Mikle20
  • 11
  • 1
0
votes
0 answers

Icon changing on it's own when resizing icons

So I'm practicing with Windows Apps and I've created a 2048 version in WinApi coded in C++. Added a simple icon created in Paint just to see how it works, now few mins ago I've created a better looking one to update the game and add few features,…
Survaf93
  • 162
  • 1
  • 11
0
votes
2 answers

Changing background image inside WinApi

So I had this issue for a while now....and I can't seem to get around it...I managed to setup the start background which is relatively easy but I just can't figure out how to change it inside my application. I have 2x Bitmaps imported with…
Survaf93
  • 162
  • 1
  • 11
0
votes
1 answer

Can't register hwnd window

I'm trying to create hwnd window but I get an error when I try to register it. The error is the MessageBox notification that kicks in if the Register function fails to register the window, I've copied most of the code so I don't really understand…
anteAdamovic
  • 1,462
  • 12
  • 23