Questions tagged [setforegroundwindow]

40 questions
14
votes
2 answers

Python win32gui SetAsForegroundWindow function not working properly

I am trying to write a program that finds a window by searching for its title. Once it has found the window, it will attempt to bring it to front. I am using win32gui API to achieve this. I am able to get it to work for the most part, but for some…
Aasam Tasaddaq
  • 597
  • 4
  • 11
  • 22
5
votes
1 answer

Allow background application to set foreground window of different process

First off, I know this is a controversal discussion but I hope we can keep this technical. I have an application which is started in background and I somehow want it to be able to activate/bring to focus a window in a different process. But calling…
divB
  • 776
  • 10
  • 23
3
votes
1 answer

SetForegroundWindow not working

I'm trying to launch an application and bring it to the front. However, the application launches ok, then ends up going behind the launching app. Note that using a similar approach on an already-running minimized application works fine (that code…
radders
  • 875
  • 8
  • 24
2
votes
1 answer

How to use ShowWIndow() and SetForegroundWindow Correctly?

Here is what I want to do: 1)Open an application with username 2)Give some inputs 3)Open 2nd window for the application with different username 4)Give some inputs again 5)Switch to first application window, do somethg 6)Switch to second…
user3325210
  • 133
  • 1
  • 11
2
votes
1 answer

In Windows 8+, how do I bring Window Desktop App to foreground when Metro App in foreground via API?

My desktop application hook some hot keys eg: CTRL+SHIFT+F12, while the hot keys are pressed, it will bring my desktop application window into foreground or stay on top. But in Window 8 or 8.1, while it is in Window Start Screen or Metro App is…
franciz
  • 23
  • 2
1
vote
1 answer

Unable to set window to foreground (Delphi)

Here is the code that I use to restore and set a window to foreground. When the window is minimized, the code work pefectly but when the window is hiding behind some other windows, I can't bring the window to the foreground then later I found out…
Lyn
  • 128
  • 10
1
vote
1 answer

Win 10: Cmd can bring windows to foreground, but any other terminal can't(even if elevated). Why is this so?

I'm using pygetwindow to bring a window to the foreground, via it's title. And it works flawlessly if I run my python script from cmd(and PowerShell). But if I run it from any other terminal, say Alacritty, instead of coming to the foreground, the…
1
vote
1 answer

Create a WordPad instance and bring it to the top z-order, all from a non-foreground app

I am working with voice-operated software (Dragon from Nuance, or maybe Windows Speech Recognition (haven't tried that yet)). In operation, the user (me) issues a voice command to make something happen. For this question, I am trying to write code…
Kevin
  • 972
  • 1
  • 8
  • 24
1
vote
2 answers

C++ program to bring a process to foreground if already running otherwise create a new process

I am trying to learn windows programming. I would like to launch an executable program.exe (say) from c++ code. I am able to achieve this by using CreateProcess() method in windows. However, my problem is if the process is already created and…
Akhilesh Pandey
  • 768
  • 6
  • 16
1
vote
1 answer

Bringing a window to foreground from a background process

My situation: A browser displays a webpage served by a locally running webserver. When the user clicks a button on the page, I would like to jump to another, possibly already running, application. Working on Windows, I thought about processing the…
phimuemue
  • 30,699
  • 8
  • 74
  • 109
1
vote
2 answers

How to implement a wpf launcher with SetForegroundWindow

I'm trying to implement a button command that launches a new WPF application the first time the user clicks the button and then (when the user clicks the button again) sends it to foreground, if it's already running. The whole thing is running on…
user6996876
1
vote
0 answers

Need to close 'save as' window in e2e test. SendKey using C#

I need to implement e2e automated test of printing to file as emulation of printing process using GUI. I have Web application running under selenium and nunit. It presses Print button. Printing application installed on computer. It prints data…
Artem G
  • 1,704
  • 1
  • 19
  • 25
1
vote
1 answer

Remote Desktop Connection - SetForeground Window not working

I have very similar problem to this one : SetForegroundWindow in Remote Desktop Connection Everything works when I am connected and watching the RDC, but when I'm not.. Nothing happens. I am using python and pywinauto, trying to use SendKeys method…
Muco
  • 27
  • 9
1
vote
1 answer

C# SetforegroundWindow to VB.Net then SendKeys

I'm automating some processes. I run a VB.net application and need to input a password, tab through to the "sign in" button, send enter, tab through to the "run loads" button and hit enter. The SendKey part doesn't seem to be the problem; it's…
HanH1113
  • 149
  • 1
  • 1
  • 10
1
vote
1 answer

Have the program read an ini file to select and activate different windows

I want to write a small app that switches between different windows at 6 second intervals. It will all be explorer url's but they will change from time to time (daily), therefore I want to create a ini file where I can update the url daily, and then…
Nightfearz
  • 11
  • 2
1
2 3