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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:17:21+00:00 2026-06-06T04:17:21+00:00

I’m trying to create a C#.NET 2.0 script to automate a workflow in a

  • 0

I’m trying to create a C#.NET 2.0 script to automate a workflow in a third party application written in Java.

I’m using the user32.dll functions to be able to interact with the Java app windows.

My problem is that the Java app windows are slow to completely load and my action sent through IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, UInt32 wParam, IntPtr lParam) sometimes are lost. Example: during the load of the main window, if I try to open a menu (at this moment I actually have a handle on the main window), my message just is lost and the menu never opens.

I found some answers on Stack Overflow telling that we could use the Process.WaitForInputIdle() method for that purpose but I discovered that this only works if the app is mono threaded which is not the case of my Java app. ( C# SendKeys Wait for Program to Load before sending )

I’m looking for something working the same idea but that supports multithread or any other idea you could have?!: )

Following the Mari9′ idea I finally used the System.Diagnostic.PerformanceCounter() to watch the third party app process activity. Then it commes to 0, it means the process has done what it had to do and is able to execute the message I send it.

PerformanceCounter PC = new PerformanceCounter();
PC.CategoryName = "Process";
PC.CounterName = "% Processor Time";
PC.InstanceName = "<process name>";
Console.WriteLine(PC.NextValue().ToString());
  • 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-06T04:17:23+00:00Added an answer on June 6, 2026 at 4:17 am

    I assume you have a way of detecting when the window you want to send input to is shown on screen, but sending input immediately does not work since the window is busy.

    You could have a predefined/hardcoded wait interval (possibly customized for each Java window) – this is not very reliable, but may work well in a controlled environment (for instance if the app is used only on your computer).

    If the appearance of the window changes reliably when loading is complete, you might capture a screenshot of the window and test to see if the right pixels are there, and repeat this until true before sending the message.

    Another option is using Spy++ to see if any particular message is generated for a window when the loading is complete (eg. could be a repaint with certain parameters) and install a hook to detect those messages.

    If the Java application uses native window controls (SWT), you could try to detect changes in the window texts/structure indicating that the load is complete.

    If the window loading process is resource intensive you might also monitor the CPU usage of the java app, and wait for the end of the ‘peak’ before sending your message.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

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.