Programmatically, how does this application detect that a program is ready for input

前端 未结 3 813
清歌不尽
清歌不尽 2021-01-20 22:51

I need to build a small C# application which measures start up times for a definable application. I have found this free tool:

http://www.passmark.com/products/appti

相关标签:
3条回答
  • 2021-01-20 22:56

    You can call

    WaitForInputIdle( ProcessInfo.hProcess, INFINITE );
    

    Waits until the specified process has finished processing its initial input and is waiting for user input with no input pending, or until the time-out interval has elapsed.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms687022(v=vs.85).aspx

    http://www.codeproject.com/Articles/137/Sending-a-message-to-the-Main-Frame-Window-of-Anot

    0 讨论(0)
  • 2021-01-20 23:00

    It's referring to the Windows WaitForInputIdle API, which calls you back when an applicaiton has gone into an idle message loop state:

    http://blogs.msdn.com/b/oldnewthing/archive/2010/03/25/9984720.aspx

    0 讨论(0)
  • 2021-01-20 23:11

    System.Diagnostics has a method called Process.WaitForInputIdle() which will check if a process is idle.

    Note: This will only work for programs with some sort of interface though (and a message loop).

    MSDN for WaitForInoutIdle()

    Check this previous question for a good example to get your started - all you'd need to do is add the idle method, and hook up the target process:

    Also check this for some good suggestions on how to actually check if the target application has an interface. You will probably not need this though, since you are likely working with known applications.

    0 讨论(0)
提交回复
热议问题