hwnd

WPF rendering problem with HWND children in the way

回眸只為那壹抹淺笑 提交于 2019-12-05 01:24:28
问题 I suppose it is safe to say that WPF renders its contents as a window background. There are no child windows in a traditional HWND sense. So, when one introduces something HWND based in a WPF app, like a WebBrowser, things start to go wrong way it terms of visual appearance. Consider a Window having a Grid with two children, WebBrowser and something else, e.g. TextBox. If WebBrowser were a red circle instead, the TextBox would render on top of it. In case of WebBrowser, no TextBox is to be

C# show hidden window

不问归期 提交于 2019-12-04 12:15:43
I am developing an add in for excel. At some point, I can receive async events. I need to be able to show the Excel window if hidden on these events. I am able to store the Hwnd property, which I believe must be an immutable int/reference to identify my Excel window. Can someone elaborate on this Hwnd ? and explain how I can show a hidden window from C# using it ? Thanks in advance folks ;) UPDATE : shortly, that was the piece of code that sorted my problems : /// <summary>Enumeration of the different ways of showing a window using /// ShowWindow</summary> private enum WindowShowStyle : uint {

How can I scan and transfer images from a document feeder asynchronously

萝らか妹 提交于 2019-12-04 07:23:52
Which parts of the communication with TWAIN can be put into another thread, e.g. a BackgroundWorker? Or: Is it possible to split the loop that handles the image transfer? Some scanner drivers scan all images before returning to the calling application which forces the application to handle all images at once. This results in e.g. OutOfMemoryException or weird behavior in my WPF application when suddenly all events (raised after every scanned image) have to be handled at once. Additionally the application hangs until the transfer was completed. I am using TwainDotNet: http://code.google.com/p

WPF rendering problem with HWND children in the way

狂风中的少年 提交于 2019-12-03 17:21:56
I suppose it is safe to say that WPF renders its contents as a window background. There are no child windows in a traditional HWND sense. So, when one introduces something HWND based in a WPF app, like a WebBrowser, things start to go wrong way it terms of visual appearance. Consider a Window having a Grid with two children, WebBrowser and something else, e.g. TextBox. If WebBrowser were a red circle instead, the TextBox would render on top of it. In case of WebBrowser, no TextBox is to be found anywhere. This is because TextBox is rendered as main window's background and WebBrowser is

Why can't Spy++ see messages sent to UWP apps?

允我心安 提交于 2019-12-02 23:41:33
问题 While we all got tangled up in this topic, it came to light that, while UWP apps do have top level windows and you can send (sensible) messages to them (*), and these do get through and have the expected effect, Spy++ doesn't ever seem to see those messages, or indeed any others that Windows itself might send. Can anyone shed any light on this? Just to provide a bit of background, Spy has no problem locating and inspecting these windows (the 'Finder Tool' works just fine) but message logging

How to get the Handle that is executed in winexec or shellexecute?

时光毁灭记忆、已成空白 提交于 2019-12-02 09:59:38
i use to create a custom function like winexec(...):Hwnd that will retun the handle of executed application. i did use the findwindow() but having problem if it change window caption. There is no general way to get "the" window handle of an application because there's no guarantee that any program has one window handle. A program may have many top-level handles (i.e., Microsoft Word, one for each document), or it may have no windows at all. You might question what you really need the window handle for; there could be better ways of doing whatever it is you're trying to do that don't require

How to get active window app name as shown in task manager

两盒软妹~` 提交于 2019-12-01 07:39:12
I am trying to get the active window's name as shown in the task manager app list (using c#). I had the same issue as described here . I tried to do as they described but I have issue while the focused application is the picture library I get exception. I also tried this , but nothing gives me the results I expect. For now I use: IntPtr handle = IntPtr.Zero; handle = GetForegroundWindow(); const int nChars = 256; StringBuilder Buff = new StringBuilder(nChars); if (GetWindowText(handle, Buff, nChars) > 0) { windowText = Buff.ToString(); } and delete what is not relevant based on a table I

How to get active window app name as shown in task manager

耗尽温柔 提交于 2019-12-01 05:08:39
问题 I am trying to get the active window's name as shown in the task manager app list (using c#). I had the same issue as described here. I tried to do as they described but I have issue while the focused application is the picture library I get exception. I also tried this, but nothing gives me the results I expect. For now I use: IntPtr handle = IntPtr.Zero; handle = GetForegroundWindow(); const int nChars = 256; StringBuilder Buff = new StringBuilder(nChars); if (GetWindowText(handle, Buff,

How do I get a HWND from inside a DLL?

感情迁移 提交于 2019-12-01 04:40:16
问题 I have a DLL that I want to play sounds using Direct Sound. In order to play sounds, I need the HWND of the executable. I don't have a HWND of the executable that loads the DLL. How do I get that in the DLL without passing it in from the executable? 回答1: You could use GetCurrentProcessId to get the current process Id. You could then call EnumWindows, and check each window with GetWindowThreadProcessId to find a window associated with your process. However, an easier option might be to just

Can I get the behavior of setting my WinForms form's owner using an hwnd / NativeWindow?

落爺英雄遲暮 提交于 2019-11-30 09:42:33
My application is a vb6 executable, but some newer forms in the system are written in C#. I would like to be able to set the C# form's Owner property using a handle to the main application window, so that the dialogs remain on top when tabbing back and forth between my app and other apps. I can get the hwnd of the main application window. I'm not sure what I can do from there? UPDATE Oct 20 '08 at 17:06: Scott, Thanks for the response. I had overlooked that the Show/ShowDialog method parameter was not of type Form - I was looking only at the Owner property. I slightly modified the code I'm