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
1
vote
0 answers

C# Magnification API Fullscreen Handle

When magnification API is initialized and the "MagSetFullscreenColorEffect" method is called, the screen automatically changes colors to match whatever array you called. This requires relatively little code: InitializeComponent(); if…
1
vote
0 answers

How to display video in a portion of window using d3dvideosink in Windows

I have written following gstreamer function to display the videotestsrc video on a Win32 Window(HWND) in Windows. This function works perfectly and displays videotestsrc in the entire window for the given "win" window handle. void runGstPipe(HWND…
Venkata Subbarao
  • 352
  • 4
  • 22
1
vote
0 answers

Is there a way to pass a Window Handle HWND between 2 applications?

I have 2 applications, let's say App1 and App2. App1 have a console and a second window where some stuff is displayed. What i want to do is to be able to see the second window of App1 inside App2(Mirror the window in the second applicaiton) I read…
1
vote
0 answers

ChildWindowFromPoint unable to get button/text hwnd inside a tab dialog - MFC

I am working on how to get the window handle by using the mouse cursor pointing on the window. The problem is I cannot get the button/text which is inside a tab dialog. I used Spy++ to get the hierarchy, there are 3 layers to reach the desired…
1
vote
1 answer

VBA How to use FindWindowEx when have Windows Handle

I have looked over the numerous "similiar questions" that pop up when you submit a question but unfortunately none of these fit my problem, plus they are all in c++ or c#. I found this and it has helped me get the handle: My problem now is that how…
alowflyingpig
  • 730
  • 7
  • 18
1
vote
1 answer

How to render to two QWidget of one QMainWindow with OpenGL?

Having two widgets in one window with QT 5.13, one widget should render preview, while the other one should render with another camera. We used EGL. Should I create one OpenGL context attached to each QWidget/HWND used in main thread and render to…
heLomaN
  • 1,634
  • 2
  • 22
  • 33
1
vote
1 answer

How can I get the MainWindowHandle of a Windows 7 application running as user from within a service running as Local System?

I've created a service that runs as the Local System user. This service launches and monitors a Silverlight Out-of-browser application using native interop and the CreateProcessAsUser() method (to run it as the currently logged-in user, rather than…
1
vote
2 answers

VB6: Get hWnd of a child control inside a 3rd Party control

I have a vb6 third party UpDown Control (let it be ControlX), with UISpy i could see that ControlX has 2 controls inside, one is a "ThunderRT6TextBox" the other is a "UpDown20WndClass". I am drawing a border around ControlX. I am using the ControlX…
Miguel Marques
  • 2,386
  • 1
  • 20
  • 31
1
vote
0 answers

Re-launch a software minimized

I run MediaPlayerClassic, as a minimized window in the taskbar (see here and the other answer too), with: import subprocess, win32con, win32gui, win32process, win32api info = subprocess.STARTUPINFO() info.dwFlags =…
Basj
  • 41,386
  • 99
  • 383
  • 673
1
vote
2 answers

Restore window without setting to foreground

I can only take an image of a non-iconic (not minimized) window, so if I see one I restore it, but then it pops to the foreground. Right now I have this solution: if win32gui.IsIconic(hwnd): active_hwnd= win32gui.GetForegroundWindow() …
Ohad
  • 51
  • 6
1
vote
1 answer

Windows - Get HWND from TreeView for GetScrollInfo?

I'm new to Windows programming and trying to get the position of a TreeView's scroll bar. SCROLLINFO scrollInfo; ZeroMemory(&scrollInfo, sizeof(scrollInfo)); scrollInfo.cbSize = sizeof(scrollInfo); scrollInfo.fMask = SIF_TRACKPOS; tbool…
Bob S
  • 247
  • 1
  • 4
  • 11
1
vote
1 answer

PyQt embedded PuTTY / KiTTY into app - can't remove border

I want to creat some small app on Windows using python and QT (PyQt), and I want to embededd into this app ssh console. I try to use PuTTY and KiTTY, but I can't remove border (WS_BORDER , WS_CAPTION) at all. exePath = "putty.exe…
1
vote
1 answer

Creating a sub HWND handle from an existant window

I have a winform window in which I am drawing manually/programmatically, I would like to provide a HWND handle to a process I cannot modify that expressly awaits a win32 HWND (this process is then going to draw its own things in my window, using the…
KwentRell
  • 416
  • 1
  • 4
  • 17
1
vote
0 answers

c++/clr vtkInteractor with hwnd

I successfully implemented a c++ vtk rendererWindow via a clr class into windows Forms, described here: https://stackoverflow.com/a/30301203/10325189 . So many thanks for that. So my question is: is it possible to interact with this windows Form via…
Philipp
  • 11
  • 2
1
vote
0 answers

How to register callback with Windows handle?

I am using a C library that uses windows callbacks to do unsolicited messaging. I can't figure out how to register a callback with a windows handle. Here is the prototype of the function I'm attempting to use: FWLIBAPI short WINAPI…
Austen Stone
  • 948
  • 1
  • 10
  • 21