Questions tagged [getforegroundwindow]

11 questions
3
votes
2 answers

How to get the active/foreground instance of an application in case multiple application instances are running?

I'm trying to interact with Visual Studio's application instance in which the user is working i.e. the one in the foreground. I'm using GetActiveObject() to get the instance of VS. But, in case there are multiple instances of VS running, it always…
2
votes
0 answers

Invoking a program which uses GetForegroundWindow() over PSExec returns Idle

For automation purposes, I need to know the foreground window process running on a remote machine. I've written small scripts (C#, Python, Powershell) to do this - each of these scripts is using some or the other form of GetForegroundWindow() These…
Prasad
  • 21
  • 1
2
votes
1 answer

How can I get the foreground Window using batch?

I tried to get the foreground Window and write it in a file. After a few tries, I've only got the task list. Now I discovered this Code, but it won't work for me: Add-Type @" using System; using System.Runtime.InteropServices; public class…
MISO
  • 75
  • 5
2
votes
1 answer

"GetForegroundWindow: identifier not found" in visual studio 2015

I am developing a windows app in visual studio 2015 using C++. I need GetForegroundWindow() and GetWindowText() to return the app that is currently focusing on. However, it says GetForegroundWindow() and GetWindowText() are undefined even I've…
1
vote
0 answers

How to get the handle foreground window in server OS?

I have been working in a project which checks the foreground window every 5 seconds using GetForegroundWindow(), I have a doubt that if multiple users are logged on at same time(let say windows server OS), 1.Whether the function returns multiple…
0
votes
0 answers

Rust Foreground Change `SetWindowsHookExW()`

I'm trying to dive into kinda lower level programming with Rust after some experience with Node.js. Currently it is small application that counts time spent within specific windows opened. I've found that I can use windows crate to interact with…
dalvi
  • 27
  • 5
0
votes
1 answer

How to GetForegroundWindow From Path Program

When I use Process.Start(Path); Sometimes the program does not appear in the foreground, but it does appear in the taskbar To solve this problem, I must use the "AutoItX" reference to show the program in the foreground using GetForegroundWindow(),…
ATM
  • 40
  • 5
0
votes
1 answer

PowerShell Get process by its handle

$ActiveHandle = [UserWindows]::GetForegroundWindow() $Process = Get-Process | ? {$_.MainWindowHandle -eq $ActiveHandle} This code retrieves a title of the current active window. Problem is that it only filters processes by MainWindowHandle. For…
Ephebopus
  • 25
  • 2
  • 4
0
votes
0 answers

Windows Powershell GetForegroundWindow() returns multiple processes when run via Task Scheduler

I am trying to run a powershell script periodically using task scheduler. I would like to return the name of the process currently in use. I am using the code found here to do so. This works when I run the script from powershell. The process…
0
votes
2 answers

Is there any other way to get foreground window title in macOS other than AppleScript

I want to get the foreground window title in macOS. I have tried using AppleScript for this, it works but is very slow. Here is the AppleScript code: tell application "System Events" set frontApp to name of first application process whose…
Nirman
  • 103
  • 2
  • 11
0
votes
1 answer

Checking if active window is using direct3d

What would be the cleanest method for determining if the active foreground window is using direct3d. I know I can check if it has d3d modules loaded, but that alone doesn't confirm without a shadow of a doubt that it is rendering with direct3d. I…
John
  • 5,942
  • 3
  • 42
  • 79