Announcement

Collapse
No announcement yet.

Wait Until Ready

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wait Until Ready

    I've made a PB program that takes magstripe data and keys it into a third-party application that I don't have direct access to. Currently, after swiping the card, the data is formatted, the third-party application is activated (SetForegroundWindow), I SLEEP for 1250 ms, and then I use SendInput to enter the information. This works most of the time.

    Occasionally, if there are certain (high cpu) other programs running on the computer it takes slightly longer for the third-party application to appear and data is not entered.

    Is there any way for me to check this third-party application to see if it is busy doing anything (appearing on screen, drawing its windows)? What would be the best approach? Check CPU usage, hook a message queue (?), etc.? I've looked at WaitFor*Object, but it doesn't appear it would be useful in this case.

    Thanks!
    LOCAL MyEMail AS STRING
    MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

  • #2
    WaitforInputIdle() on process handle
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Maybe try checking GetForegroundWindow handle to see if your intended window actually got focus after your Sleep??? Maybe put that check into a For/Next of say 5 iterations?
      Paul Squires
      FireFly Visual Designer (for PowerBASIC Windows 10+)
      Version 3 now available.
      http://www.planetsquires.com

      Comment


      • #4
        Thank you, thank you, thank you!
        LOCAL MyEMail AS STRING
        MyEmail = STRREVERSE$("53pmohtj") & CHR$(64) & STRREVERSE$("liamg") & CHR$(46) & STRREVERSE$("moc")

        Comment


        • #5
          Inquiring Minds Want to Know: Which approach did you use?
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X