hwnd

WPF Memory Leak on XP (CMilChannel, HWND)

无人久伴 提交于 2019-11-28 20:58:02
My WPF application leaks memory at about 4kb/s. The memory usage in Task Manager climbs constantly until the application crashes with an "Out of Memory" exception. By doing my own research I have found that the problem is discussed here: Track down memory leak in WPF and #8 here: http://blogs.msdn.com/jgoldb/archive/2008/02/04/finding-memory-leaks-in-wpf-based-applications.aspx The problem described is: This is a leak in WPF present in versions of the framework up to and including .NET 3.5 SP1. This occurs because of the way WPF selects which HWND to use to send messages from the render thread

Loading a WPF Window without showing it

喜你入骨 提交于 2019-11-28 16:04:30
I create a global hot key to show a window by PInvoking RegisterHotKey() . But to do this I need that window's HWND , which doesn't exist until the window is loaded, that means shown for the first time. But I don't want to show the window before I can set the hot key. Is there a way to create a HWND for that window that is invisible to the user? Patrick Klug If you are targeting .NET 4.0 you can make use of the new EnsureHandle method available on the WindowInteropHelper : public void InitHwnd() { var helper = new WindowInteropHelper(this); helper.EnsureHandle(); } (thanks to Thomas Levesque

Get hwnd by process id c++

穿精又带淫゛_ 提交于 2019-11-28 11:12:22
How can I get the HWND of application, if I know the process ID? Anyone could post a sample please? I'm using MSV C++ 2010. I found Process::MainWindowHandle but I don't know how to use it. HWND g_HWND=NULL; BOOL CALLBACK EnumWindowsProcMy(HWND hwnd,LPARAM lParam) { DWORD lpdwProcessId; GetWindowThreadProcessId(hwnd,&lpdwProcessId); if(lpdwProcessId==lParam) { g_HWND=hwnd; return FALSE; } return TRUE; } EnumWindows(EnumWindowsProcMy,m_ProcessId); You can use EnumWindows and GetWindowThreadProcessId() functions as mentioned in this MSDN article . A single PID (Process ID) can be associated with

How do I clear a Direct2D render target to fully transparent

你离开我真会死。 提交于 2019-11-28 03:37:08
问题 I'm trying to draw semi-transparent rectangles on an invisible HWND . However, clearing the window with ID2D1HwndRenderTarget::Clear just makes the entire window black, so when I draw rectangles on top, they look semi-black. If I don't Clear() and don't draw, then the window is invisible, as it should be. Clear() is the culprit here; however if I don't use it then painting messes up pretty badly. Here's the code I'm using in my WindowProc: case WM_PAINT: // Begin drawing pRenderTarget-

What is the correct way to use ShellExecute() in C to open a .txt

不想你离开。 提交于 2019-11-28 02:07:36
问题 Alright so i need to open a .txt file that will be created in the same file as the program. I would like to use ShellExecute(); to do this and i have done a lot of research on it and i just cant seem to get the syntax correct mostly because i dont know what to do with the parameter "HWND" I looked here for the answers and got all the info except what to put in HWND Here is how i need the code used: ShellExecute(0,"open","c:\\debug.txt",NULL,NULL,1); Thanks advance for the help ask if you are

How to get tooltip text for a given HWND?

你离开我真会死。 提交于 2019-11-28 02:03:56
I'm looking for a way to get the tooltip control (if any) which is associated with a given HWND. The text of the tooltip control would be sufficient, too. The closest thing I found is the TTM_GETTEXT message, but it's meant to be sent to the tooltip control itself instead of the tool it's associated with. I don't have a handle to the tooltip control though. Does anybody know how to do this? All this is done using plain Windows API in C++. JTeagle There doesn't seem to be a specific message to get the tip or its text from the control, but this is how MFC's CWnd class implements OnToolHitTest(),

Embed HWND (Window Handle) in a JPanel

人盡茶涼 提交于 2019-11-28 00:28:14
I am trying to embed a HWND (Window Handle) in a JPanel. Actually, I can embed my HWND into a JFrame, but the embedded window alway stay on top of the other component and I can't move it. If a try to remove all the child component of my JFrame, the HWND stay there. The HWND seems to be paint on top of the JFrame and not as one of is child. To embed the HWND into the JPanel I use User32 through jna: User32.SetParent(iage.getRenderHwnd(), (int) getGUIHwnd(j)); And I use this to get the HWND of my JFrame: j.getPeer() != null ? ((WComponentPeer) j.getPeer()).getHWnd(): 0; Is there a way to embed a

Getting HWND off of CoreWindow object in UWP

这一生的挚爱 提交于 2019-11-27 23:15:52
This short MSDN documentation says CoreWindow has ICoreWindowInterop that obtains the handle HWND to the CoreWindow. But I cannot find references on how to get it (C#). Help, please. https://msdn.microsoft.com/en-us/library/dn302119(v=vs.85).aspx This COM interface is only directly accessible to C++ code. In C# you have to declare it yourself and make it match the interface declaration in C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt\CoreWindow.idl. Like this: using System.Runtime.InteropServices; ... [ComImport, Guid("45D64A29-A63E-4CB6-B498-5781D298CB4F")] [InterfaceType

Is the order in which handles are returned by EnumWindows meaningful?

时间秒杀一切 提交于 2019-11-27 20:58:57
问题 From a couple of preliminary tests it seems that EnumWindows always returns windows in reverse instantiation order, i.e. most recently instantiated window first. Is that a valid observation? If so, is it true across all versions of Windows? And is this a reliable assumption, i.e. is that behaviour documented somewhere? Context: I'm dealing with a situation where I am triggering a third-party application to open several non-modal windows and I need to send some window messages to those windows

How can I get the window handle (hWnd) for a Stage in JavaFX?

本小妞迷上赌 提交于 2019-11-27 19:02:58
问题 We're building a JavaFX application in Windows, and we want to be able to do some things to manipulate how our application appears in the Windows 7/8 taskbar. This requires modifying a Windows variable called the "Application User Model ID". We've already managed to do exactly what we want in Swing by using JNA, and we'd like to repeat our solution in JavaFX. Unfortunately, to do this, we need to be able to retrieve the hWnd (window handle) for each window in our application. This can be done