Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:11:56+00:00 2026-06-01T00:11:56+00:00

I have a setup application that if user clicks the same setup twice, they

  • 0

I have a setup application that if user clicks the same setup twice, they would get the pop up message “Another setup instance already running”. Upon clicking OK on that message I want to put focus back on the existing installation window which has been running. I currently have the following codes:

if("setup.exe" == CString(buffer))
EnumWindows(EnumWindowsProc,(LPARAM)processID);


BOOL CALLBACK EnumWindowsProc(HWND windowHandle,LPARAM lParam)
{
DWORD searchedProcessId = (DWORD)lParam;
DWORD windowProcessId = 0;

GetWindowThreadProcessId(windowHandle,&windowProcessId);

if(searchedProcessId == windowProcessId)
{
       //Set focus when detects the right window.
       SetForegroundWindow(windowHandle);
       return FALSE;
}
return TRUE;
 } 

The above code works if I stay on the first screen/step on the installation wizard (install shield).

When I move to the next screen on the installation wizard, this focus logic no longer works. Upon debugging I found that the function GetWindowThreadProcessId could not find any windowProcessID that match searchedProcessId. I also confirmed the following:

  • the searchProcessId value remains the same whether I am on the 1st or 2nd installation screen.
  • I confirmed I see the searchProcessID value exists when I view in in the window task manager.

I read up on GetWindowThreadProcessId and see the following note: “The return value is the identifier of the thread that created the window.” In my own interpretation, was this because the 2nd step/screen on the wizard is generated by its own thread?

I tried to play around with EnumChildWindow() function but that did not help. I’d be very appricated if anyone able to point me in the right direction of trying to get this to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:11:57+00:00Added an answer on June 1, 2026 at 12:11 am

    I would use Spy++ which comes with Visual Studio or a similar system monitoring tool to show you all the windows/threads so you can try to confirm exactly what the install wizard is doing. Chances are EnumWindows() is working just fine and it is a problem with your code or your assumptions of how things work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an application that uses a dual monitor setup - User A will
I have a NamedPipeClientStream instance in my application that is setup for duplex communication
All, I have my application setup so that i can use a specific username
ISS and ASP.NET. In my setup I have a web application that must be
So my setup for my web application is that I have a general header
I have a Inno Setup project that I want to check if the application
I have a dependency injection container setup in my application and I'm thinking that
I have an application installer created with Inno Setup that deploys multiple binaries and
I have a really simple ASP.NET web application and a web setup project that
The set-up: I have an android application that so far can register a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.