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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
120 views

Getting a WindowId from a window handle (HWND) without Windows App SDK

I want to get a WindowId from a HWND from F# and .NET so I can call other WinRT APIs which want a WindowID. I think this is done in WIL: inline winrt::Windows::UI::WindowId GetWindowIdFromWindow(...
Nick Darvey's user avatar
  • 1,029
0 votes
1 answer
44 views

Child Window closes application when close button is clicked

I have a button and want to open a new window when the button is pressed. HWND hwnd; void CreateChildWindow() { HWND hNewWindow = CreateWindow( _T("OtherSimpleWindowClass"), ...
mbrain's user avatar
  • 50
0 votes
0 answers
38 views

WinUI 3: WinRT.Interop.WindowNative.GetWindowHandle(this) crashes application [duplicate]

I have a button in my Xaml code like this: <Button x:Name="PickFolderButton" Click="PickFolderButton_Click"/> and the code behind is this: private async void ...
lajawi's user avatar
  • 101
2 votes
0 answers
75 views

Unable to figure out problem with BitBlt in win32

I am new to windows programming and stuck with legacy code of software and having difficulty in figuring out the cause. The problem at hand is I have a SourceHDC and I am dumping it onto ScreenDC(HWND)...
native_window's user avatar
0 votes
1 answer
76 views

Why does the window handle not get stored properly?

First you get a MCWE. You know probably better than me how to use it but I would recommend to build a C++ project from scratch and add it then. It uses Unicode character set, make sure to use windows ...
thielo06's user avatar
1 vote
1 answer
345 views

How to init glad without the glfw loader (using windows headers)

I'm trying to render to a HWND window using a HGLRC OpenGL rendering context. I have to initiate the glad but gladLoadGLLoader((GLADloadproc)wglGetProcAddress)) and the gladLoadGL() seems to be ...
LucasSokol's user avatar
1 vote
2 answers
92 views

HGLRC OpenGL rendering context - How to indicate the version of the OpenGL

How I'm creating my rendering context using wgl : //Device HDC hdc = GetDC(hWnd); HGLRC hRC = wglCreateContext(hdc); How/where/when should I change the version of the OpenGL context? Is there a ...
LucasSokol's user avatar
1 vote
0 answers
42 views

C# FindWindowsEx unable to get child handle

I want to launch an external application and get the handle of its Connect button. I get the top level "000A0B32" and I can get this 100% correct. Then I'm trying to get the child element &...
okaken's user avatar
  • 13
0 votes
1 answer
111 views

Right way to implement SourceInitialized in wpf

Recently I working on WPF application where I was getting exception related to Out of memory error. Here is the exception : System.OutOfMemoryException: Insufficient memory to continue the execution ...
Doge's user avatar
  • 23
0 votes
1 answer
88 views

How to get the hWnd of a floating window of an application

I want to get (and alter the position of) the windows on my screen. I have managed to do so with the code below. But some applications have floating windows (e.g. I have the Solution Explorer floating ...
ffonz's user avatar
  • 1,314
0 votes
0 answers
40 views

How to keep track of time on all windows with Python?

So basically I'm trying to make a script of code that keep in track of time for every window I'm on, which windows/app/games I am on the most, and the name of the windows I have opened. My friend gave ...
Da_Coder's user avatar
1 vote
0 answers
408 views

Have Direct2D, DXGI SwapChain, HWND transparency, all working at once in C++, without XAML or similar

Context I have 2 big projects I'm working on: a game engine, and a file explorer replacement. My focus is Windows only. I know they're 2 huge things I'll likely never complete, I just enjoy coding ...
Barnack's user avatar
  • 931
1 vote
1 answer
278 views

Can't display unicode on title bar in WIN32

I have been trying to create a Window whose title bar could be in any language. But I am getting something like ▯*. I writing as escape characters as of now. I am attesting the entirity of the code. #...
Ashutosh Jha's user avatar
0 votes
1 answer
221 views

Changing opacity of child window without using WS_EX_LAYERED

I have a window and then I create a child window using the following code: HWND childHwnd = CreateWindowExA(WS_EX_LAYERED, "Test", "Test", WS_CHILD, 0, 0, 500, 500, mainHwnd, NULL, ...
ppp's user avatar
  • 3
0 votes
0 answers
62 views

GetMessageTime not work when trying building non-GUI application

I'm trying to make a screenshot helper that takes screenshots when it receives signal from other application. In my design, the higher layer application will send a window message to the helper, and ...
June's user avatar
  • 1
-1 votes
1 answer
461 views

Given an HWND, how can I cast to a String in C++?

I need to write a program in C++ that queries the OS for running Windows, find a Window with a specific window title, and return the Native Window Handle value as a String. So far, I've figured out ...
lakers5824's user avatar
0 votes
0 answers
201 views

How to display CCTV from hWnd to ImageSource in WPF?

I have a ipcamera SDK (surveillance) that work well on WinForms. Currently, I'm using WPF MVVM. I have try using <WindowsFormsHost> and using PictureBox, and it's shows but as I search, these ...
Luiey's user avatar
  • 863
1 vote
0 answers
12 views

How can I capture the HWND of the last opened Explorer window before my PowerShell script console opens? [duplicate]

I have a script that is invoked via right click context menu in Windows Explorer. I'm not sure if this is possible, but I want to capture the HWND of the window from which I invoked the script. Right ...
fmotion1's user avatar
  • 331
0 votes
0 answers
352 views

How to get a specific Windows hwnd with win32gui?

Okay so I'm using win32gui.SetForegroundWindow(hwnd_here) to try and give focus to or at least set to the foreground a specific window. My problem is that the hwnd changes each time the program is ...
BipBop's user avatar
  • 1
0 votes
0 answers
56 views

How to get the contents of the console window, if FarManager is running in it

I have an application that use a CreateProcess() function and create a new console window with FarManager run inside. The FarManager is installed on the computer and registered in the environment ...
Zhe87's user avatar
  • 11
0 votes
0 answers
132 views

HwndHost leaks memory

we have an external video player to which i need to give a reference to a HwndHost, and then the external video player renders into it. all works fine, but i cant find out why memory is leaked, as new ...
Milan's user avatar
  • 616
0 votes
0 answers
88 views

Selecting an external Window & Push Values/Keys to it using VB.NET

I am trying to send keystrokes (TAB) a couple of times within an external window from a vb.net program. How can I select/activate the window (for example, how would I do it if it's a Word document/ I ...
Cevillasenor's user avatar
0 votes
2 answers
265 views

Delphi FireMonkey multi HWND in a form

I am quite new to FireMonkey. I am shifting an old VCL project to Firemonkey. One of the requirements is I need to embed several video players in one form. The player itself needs an HWND parameter to ...
NBuyer's user avatar
  • 36
0 votes
1 answer
305 views

How to pass an HWND as a GLFWwindow*?

I have an HWND that I have been using as the target of OpenGL draw operations, and it is necessary that it be an HWND and not a GLFWwindow for other utilities of the application I'm making. The ...
Braden Yonano's user avatar
7 votes
1 answer
6k views

How to retrieve the window handle of the current WinUI 3 MainWindow from a page in a frame in a NavigationView control on the MainWindow

I am creating my first WinUI 3 desktop application. I have a NavigationView on my MainWindow. I have 9 different pages that I navigate to via the frame in the NavigationView. One of the pages is for ...
LennyL's user avatar
  • 243
0 votes
2 answers
1k views

How to get the Window handle (hwnd) by Executable path or name?

Is there a way to get the hwnd-object from a specific window by only providing the executable path or name? Like GetForegroundWindow() from win32gui but not just the foreground window. Id imagine ...
Nx2's user avatar
  • 19
0 votes
1 answer
508 views

How to access native hwnd of window with electron on windows in preload.js?

Here I want show the hwnd of a BrowserWindow in a electron window: // preload.js window.addEventListener('DOMContentLoaded', () => { const replaceText = (selector, text) => { const ...
heLomaN's user avatar
  • 1,674
1 vote
1 answer
289 views

openCV - Using matchTemplate() from a window using hWND C++

I am running an infinite loop and every frame I'm taking a screenshot from a desired window and turning it into a Mat then searching that Mat for a template image using matchTemplate. If I read in the ...
Bobby Phlay's user avatar
0 votes
2 answers
498 views

Python wheel mouse with win32con

Please tell me how to solve my little problem. I am writing automation for the android emulator, where I use the win32api libraries to emulate actions in an inactive program window. And at some point ...
Aleksandr Vandal's user avatar
5 votes
0 answers
406 views

Win32: Enumerate real windows in real activation order

I am beyond tired researching this topic at this point. There are a million APIs in the system to achieve part of this, i.e. enumerate all windows, but nothing about how to get them in the real z-...
user1371019's user avatar
0 votes
0 answers
2k views

PyWin32 PostMessage or SendMessage won't send keystrokes without window focus on BlueStacks

I can get my code to work if the window is in focus. However, if I test this on Notepad or other programs it works just fine. I use the same method to simulate mouse clicks without focus. It just ...
Daniel Rigney's user avatar
0 votes
0 answers
288 views

How to paint on wallpaper above icons? Alternative to progman 0x052C

I created a simple windows app that i want to pin to my desktop similar to a wallpaper widget. I am using a nodeJS module that is almost doing everything i want. Essentially from my limited ...
Patrick's user avatar
  • 810
0 votes
0 answers
317 views

How to find window id for recording specific window using Qt on Windows operating system?

How can I create video of specific window on Windows operating system using Qt? Specific window can be any opened GUI program like Chrome, Notepad etc QScreen *screen = QGuiApplication::primaryScreen()...
Alok's user avatar
  • 8,098
0 votes
1 answer
608 views

Simplest way to read MFC messages from HWND?

I am trying to use an api library with functions that send messages to a server, then receive back messages. One of the function's arguments is a HWND and the library document says the message will be ...
Hpotato's user avatar
-1 votes
1 answer
327 views

Sending message to explorer.exe main window with a hook causes crash?

I am trying to set a WH_CALLWNDPROC hook on a window using the HWND I got from WindowFromPoint and send a message WM_USER+x after. But depending on the HWND I use it crashes the window. Let me explain ...
Nur1's user avatar
  • 438
0 votes
1 answer
413 views

win32: is there a WM sent to the child when parent window is destroyed, or orphans the child?

I'm developing a plugin so I don't own the parent window, but it would help me workaround an issue if i can figure out when the parent window of my window is destroyed (or alternatively when it ...
James's user avatar
  • 21
1 vote
0 answers
200 views

How to get WM_COPYDATA in python

i'm trying to do (what should be) some minor work with win32. I basically just need to send a message and wait for a response. I need the HWND or window handle of my python script/program to actually ...
BunnyHoppin's user avatar
0 votes
0 answers
74 views

Show same dialog twice in nested tab structure

In a nested tab structure of type CMFCTabCtrl(e.g. CMFCTabCtrl as Tab in parent CMFCTabCtrl), how can I show a parents tab inside the parent tab and a child CMFCTabCtrl tab? ParentTab1 ParentTab2 ...
ezegoing's user avatar
  • 526
0 votes
1 answer
352 views

Print shows the same String but if == fails

I'm trying to compare 2 strings, but == operator fails. they seem to have the same Value if you print them. Even the type is the same: class str, the output of print(repr( )) ist the same, .strip() ...
Blu3bar0n's user avatar
0 votes
0 answers
245 views

Get threadId of explorer.exe or get threadId by processName

I'm trying to get the threadId of explorer.exe. I'm not quite sure how to go about doing that. I've looked into win32 apis for functions of appropriate names, but I haven't quite found what I'm ...
user8694-03's user avatar
0 votes
1 answer
108 views

How do I put the window's handle into bytes and play a video with winmm in FASM?

I've been trying to play a video inside of my app using winmm; I found an example for VB and translated it to FASM, but I can't figure out how to put the window's handle into the byte that I'm trying ...
fasm14's user avatar
  • 43
-2 votes
2 answers
260 views

What's the format value from the HWND returned from CreateWindow()?

Is this a memory address ranging to (theorically) 2^32-1 on 32-bit machine? The reason I'd like to know that is I'm trying to somehow associate a HWND returned by CreateWindow() to a class instance, ...
Jack's user avatar
  • 16.3k
1 vote
1 answer
221 views

How can you get the handle of a chrome process in java using JNA

I am new to JNA, and I need to take a screenshot of a chrome window using java and JNA, I already have the function for taking screenshots of a given window using this code: public BufferedImage ...
xliquid's user avatar
  • 17
1 vote
2 answers
610 views

In Win32, How can I detect if a HWND is a dialog?

In a pure C Win32 application, how can I detect if a HWND is a dialog?
rodrigocfd's user avatar
  • 6,731
0 votes
0 answers
69 views

Obtaining a handle or UIA ID of Explorer's scrollbar place-marker

If you have a folder sorted by a certain column, and then you click and drag the vertical scrollbar, Explorer will display a little helper rectangle showing where in the sort list you currently are. ...
user avatar
0 votes
1 answer
62 views

Buttons in vector not responding to custom drawing

I have a Win32 program in which I have a vector which contains the HWND of some buttons which I want to custom draw. I can owner-draw them, but all I want to do is change the background color, so it ...
professionalgrammer's user avatar
0 votes
1 answer
2k views

Python activate windows with the same name

So what I need do to is periodically change the active window, my issue is that they all have the same name and using their HWND only works for the first window. Besides that i'd like to not have to ...
Gexegiv's user avatar
0 votes
0 answers
245 views

Convert HWND to LPWSTR? [duplicate]

I have the following code: MessageBox(NULL, NULL, (LPCWSTR)FindWindow(NULL, L"Untitled - Notepad"), MB_OK); How can i make the messagebox's title be the Window Handle to notepad? Is there ...
Noah.Ehrnstrom's user avatar
1 vote
1 answer
401 views

hwnd window handle problem in saving file in different locations

New to windows forms/window handle. Trying to save files in different locations. SaveFileDialog Image: enter image description here I am able to get the edit box handle of the file name edit boxes in ...
Baj B's user avatar
  • 65
0 votes
1 answer
132 views

How to determine the HWND in an ATL message map with contained windows

Let's say you're creating an ATL CWindowImpl class with one or more CContainedWindows. And then let's say you want to chain some of the CContainedWindows' ALT_MSG_MAPs so that a couple windows share ...
user avatar

1
2 3 4 5
8