hwnd

GetDlgCtrlID for top-level window with menu bar - return value

邮差的信 提交于 2019-12-26 15:53:03
问题 MSDN -> "GetDlgCtrlID function" -> Remarks: "... Although GetDlgCtrlID may return a value if hwndCtl is a handle to a top-level window, top-level windows cannot have identifiers and such a return value is never valid." It seems it is wrong information - "never valid". At least for Win2k...Win8 this return value is just kernel pointer to hmenu(bar). And my question is (primarily to MS insiders): why MSDN so inaccurate here? (Screenshot: http://files.rsdn.ru/42164/gwl(-1)_tagwnd.png) Upd

Monitor creation of a window (HWND)

こ雲淡風輕ζ 提交于 2019-12-25 01:10:02
问题 I would like to Monitor the creation of windows (HWND) in C. I'd like to know if there's some kind of event that the WINAPI provides to handle the creation of a window. 回答1: If you are concerned only with top-level windows, you can use SetWindowHookEx to register a ShellProc and watch for HSHELL_WINDOWCREATED . If you need notification of the creation of any window, you can use a CallWndProc and watch for WM_CREATE messages. 来源: https://stackoverflow.com/questions/7019523/monitor-creation-of

C++ Why Sendmessage doesnt work?

旧街凉风 提交于 2019-12-23 06:37:48
问题 In C#, this SendMessage function raise up volume successfull: [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); SendMessage(Handle, 0x319, (int)Handle, APPCOMMAND_VOLUME_UP); But in C++, this SendMessage function dont work, that is volume doesnt rise up: // HWND hwnd = CreateWindow(... SetWindowText(hwnd, "Hi"); // Worked SendMessage(hwnd, WM_APPCOMMAND, (int)hwnd, APPCOMMAND_VOLUME_UP); // Don't work What do I wrong? Can you help

C++ Why Sendmessage doesnt work?

若如初见. 提交于 2019-12-23 06:35:05
问题 In C#, this SendMessage function raise up volume successfull: [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); SendMessage(Handle, 0x319, (int)Handle, APPCOMMAND_VOLUME_UP); But in C++, this SendMessage function dont work, that is volume doesnt rise up: // HWND hwnd = CreateWindow(... SetWindowText(hwnd, "Hi"); // Worked SendMessage(hwnd, WM_APPCOMMAND, (int)hwnd, APPCOMMAND_VOLUME_UP); // Don't work What do I wrong? Can you help

Is HWND visible?

蹲街弑〆低调 提交于 2019-12-22 05:53:32
问题 Those darned users and their minimized windows. In C#, if I have a window's HWND, is there a way to tell if it is visible on the desktop? 回答1: The GetWindowPlacement function returns a WINDOWPLACEMENT structure which has a field showCmd : Specifies the current show state of the window. The details of this read as though you would be setting the window state, but I suspect that this is because they've been copied from somewhere else and not updated. 回答2: There's the Visible property, but that

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

混江龙づ霸主 提交于 2019-12-21 12:31:37
问题 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

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

强颜欢笑 提交于 2019-12-20 05:49:27
问题 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. 回答1: 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

Embed HWND (Window Handle) in a JPanel

≯℡__Kan透↙ 提交于 2019-12-17 16:39:28
问题 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

How do I get the handle of a console application's window

核能气质少年 提交于 2019-12-17 06:12:35
问题 Can someone tell me how to get the handle of a Windows console application in C#? In a Windows Forms application, I would normally try this.Handle . 回答1: Not sure it works, but you can try that : IntPtr handle = Process.GetCurrentProcess().MainWindowHandle; 回答2: The aforementioned Process.MainWindowHandle method only works for the process that started the console The FindWindowByCaption method is inherently unreliable Here's a robust way to do this: The related functions from the Console

How do I determine the internal HWND used by COM in my current process?

故事扮演 提交于 2019-12-14 04:14:36
问题 I want to Post messages directly to the HWND that's owned by COM in my process. How do I get the HWND that COM is using in single-threaded-apartment mode? 回答1: Try this: HWND prevWindow = NULL; HWND hwnd; for ( ;; ) { hwnd = FindWindowEx( HWND_MESSAGE, prevWindow, L"OleMainThreadWndClass", NULL ); if ( !hwnd ) break; if ( GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId() ) break; prevWindow = hwnd; WCHAR className[255]; *className = 0; ::GetClassName( hwnd, className, 255 ); }