active-window

Delphi Active Window Screenshot

爷,独闯天下 提交于 2019-12-29 09:16:25
问题 I am trying to add capture screenshot of active window using this code procedure ScreenShot(activeWindow: bool; destBitmap : TBitmap) ; var w,h : integer; DC : HDC; hWin : Cardinal; r : TRect; begin if activeWindow then begin hWin := GetForegroundWindow; dc := GetWindowDC(hWin) ; GetWindowRect(hWin,r) ; w := r.Right - r.Left; h := r.Bottom - r.Top; end else begin hWin := GetForegroundWindow; dc := GetDC(hWin) ; w := GetDeviceCaps (DC, HORZRES) ; h := GetDeviceCaps (DC, VERTRES) ; end; try

How do I check if a certain process has focus?

谁说我不能喝 提交于 2019-12-25 18:54:56
问题 I'm trying to check if javaw.exe has focus, then execute certain code if it does. Previously I had code which would look for the process ID of javaw.exe, then compare it to the process which currently had focus, which worked for awhile, but then I noticed when I had more than one javaw.exe process running, it would only work on one of those processes, while I need it to work when any javaw.exe process has focus. Is there any way to do this? 回答1: You can determine this quite easily using the

Show window in Qt without stealing focus

£可爱£侵袭症+ 提交于 2019-12-17 22:18:08
问题 I'm using the Qt library to show a slideshow on the second monitor when the user isn't using the second monitor. An example is the user playing a game in the first monitor and showing the slideshow in the second monitor. The problem is that when I open a new window in Qt, it automatically steals the focus from the previous application. Is there any way to prevent this from happening? 回答1: It took me a while to find it but I found it: setAttribute(Qt::WA_ShowWithoutActivating); This forces the

Send information between 2 wpf windows

陌路散爱 提交于 2019-12-12 04:16:58
问题 We have 2 windows open, like a chat This is what the textBox and the button looks like: private void textBox_chat_TextChanged(object sender, TextChangedEventArgs e) { } private void button_enviar_Click(object sender, RoutedEventArgs e) { string chatMessage = textBox_chat.Text; } I would like to know how can I send information insered in a textbox by pressing the button "button_enviar". And to be printed to the other window. I have been looking things like Application.Current.Windows ... but

Find Width of Excel Scroll Bar

烈酒焚心 提交于 2019-12-11 12:43:30
问题 Activewindow.UsableWidth gives me the width of the screen with the Vertical Scroll Bar's width included. Is there a way I can calculate the width of the Scroll Bar? I measured it by having one shape be UsableWidth and the other shape be what I actually can see, and the difference is the width of the Scroll Bar. I'm wondering if there's a way to automate it so it can be used by a user with a higher or lower resolution, and therefore smaller or larger Scroll Bar. Thank you! 回答1: If you are

How to get name of active window?

有些话、适合烂在心里 提交于 2019-12-08 05:42:08
问题 I've confronted with problem of getting active window's name. When I use this code: HWND currentWindowHWND = GetForegroundWindow(); char title[100]; GetWindowTextA(currentWindowHWND, title, 100); I get something like: "How to get active window's name? - Stack Overflow - Google Chrome". But I want to get "Google Chrome", which WINAPI function should I use? 回答1: in a c code use the following winapi functions: DWORD WINAPI GetModuleFileName( _In_opt_ HMODULE hModule, _Out_ LPTSTR lpFilename, _In

c# screenshot of active window but doesn't caputre the window

蹲街弑〆低调 提交于 2019-12-08 01:41:17
问题 I'm creating an application in which I need to create a PDF file with the screenshot of the application. I found how to create the screenshot and how to put it in my file. All is working well in most situations. My problem comes when I use more than one screen or a programm like Teamviewer. The problem is, my programm captures the right area (good coordinates on the screen whenever which screen) but it captures all what's behind the window but not the window. Does somebody knows what am I

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,

Show window in Qt without stealing focus

放肆的年华 提交于 2019-11-28 18:12:19
I'm using the Qt library to show a slideshow on the second monitor when the user isn't using the second monitor. An example is the user playing a game in the first monitor and showing the slideshow in the second monitor. The problem is that when I open a new window in Qt, it automatically steals the focus from the previous application. Is there any way to prevent this from happening? dutchmega It took me a while to find it but I found it: setAttribute(Qt::WA_ShowWithoutActivating); This forces the window not to activate. Even with the Qt::WindowStaysOnTopHint flag If you want to make floating