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 8358017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:40:04+00:00 2026-06-09T10:40:04+00:00

My program is in win forms (c#). It should open an external program, do

  • 0

My program is in win forms (c#). It should open an external program, do a printscreen of it’s main window, and close it.
By using Process.Start() I can open the the program, but then all the focus is on it and my code is halted. Only when I close it myself my form continues- but it’s too late for the screenshot.
So how do I force my code to keep running?

    public void Runttk(string maromnum)
    {
        Process runttk = new Process();
        runttk.StartInfo.UseShellExecute = true;               
        runttk.StartInfo.FileName = @"C:\\program.exe";
        runttk.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
        runttk.Start();
        this.Focus();
        try
        {
            if (runttk.WaitForInputIdle()==true)
            {                                          
                PringJpg(maromnum);
                Killttk();
            }
        }
        catch (Exception e)
        {
        }

    }

Thank you

UPDATE:
eventuanlly I’ve used Thread.Sleep(3000). Crued but do the trick.
I didn’t used backgroundworker because the sync between the finale uplaod the the extenral program and my code wasn’t clear enough.

  • 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-09T10:40:05+00:00Added an answer on June 9, 2026 at 10:40 am

    Trying your code, but with another program like notepad.exe, Notepad runs and then control drops through to where you call PringJpg.

    So I think the problem is that it is blocking on if (runttk.WaitForInputIdle()==true), please try adding a timeout to this operation.

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

Sidebar

Related Questions

I'm developing a .net 3.5 Win Forms program and I've run into an interesting
I have an OCR program, written with C# (WinForms app). So it's main purpose
I am trying to send mail using SmtpClient() within my Winforms VB.Net program Here
Hi I am working in a c++ program in win OS. Currently, by a
I am trying to rearchitecture a program which runs on Win CE 5.0 devices,
I want to make a program work and compile in both WIN\Linux . I
Can a WinForms exe be installed to program files instead of the user profile
how do you update a win forms control (ex. label, progress bar) from another
I've built a program in C# Windows Forms, now on the first load up
How can this be done Login window appears first and if every thing is

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.