SendInput too slow

Discussion in 'C++' started by Barb, Oct 3, 2003.

  1. Barb

    Barb Guest

    I am using SendInput to read a line from a file and then simulate
    typing it into an Edit Control box using SendInput. When I read a file
    with multiple line, the output file saves the original first line as
    the second line, original second line as the third line, etc... The
    last line of the original file never gets saved but it appears in the
    Edit box. I am using GetWindowText() to grab the next after it has
    been typed into the Edit box. It seems that the GetWindow Text command
    is called before the keyboard buffer has a chance to empty into the
    edit field. Please find code attached below.
    Any help would be much appreciated.

    Thanks!

    -------
    CString type( CString inStr )
    {
    // inStr contains the text of the current line
    CString outStr;

    for ( int i = 0; i < inStr.GetLenght(), i++ )
    {
    currChar = inStr.GetAt( i );
    simulate( currChar ); // this function outputs one char at
    a time
    }

    m_EditField.GetWindowText( outStr );
    m_EditField.SetWindowText( "" );

    return outStr;
    }
    Barb, Oct 3, 2003
    #1
    1. Advertising

  2. Barb wrote:
    > I am using SendInput to read a line from a file and then simulate
    > typing it into an Edit Control box using SendInput. When I read a file
    > with multiple line, the output file saves the original first line as
    > the second line, original second line as the third line, etc... The
    > last line of the original file never gets saved but it appears in the
    > Edit box. I am using GetWindowText() to grab the next after it has
    > been typed into the Edit box. It seems that the GetWindow Text command
    > is called before the keyboard buffer has a chance to empty into the
    > edit field. Please find code attached below.
    > Any help would be much appreciated.
    >
    > Thanks!
    >
    > -------
    > CString type( CString inStr )
    > {
    > // inStr contains the text of the current line
    > CString outStr;
    >
    > for ( int i = 0; i < inStr.GetLenght(), i++ )

    Is this a misspelling?
    Should it be inStr.GetLength()?

    > {
    > currChar = inStr.GetAt( i );
    > simulate( currChar ); // this function outputs one char at
    > a time
    > }
    >
    > m_EditField.GetWindowText( outStr );
    > m_EditField.SetWindowText( "" );
    >
    > return outStr;
    > }


    I don't see any standard C++ issues with your code, but then
    you didn't include any declarations for these identifiers:
    CString (Not a standard type.)
    currChar (Type is unknown)
    simulate (Not a standard function, no declaration)
    m_EditField (Type is unknown)

    You should ask in a newsgroup about your platform since the
    standard C++ language has no facilities for Control Boxes
    nor Windows.

    Also, post the minimal _compilable_ code. See the FAQ
    below on how to post. Which FAQ, read them all.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    Thomas Matthews, Oct 3, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin
    Replies:
    0
    Views:
    462
    Martin
    Aug 4, 2004
  2. SB
    Replies:
    0
    Views:
    367
  3. Adam W.

    How do I use SendInput in Python?

    Adam W., Feb 16, 2008, in forum: Python
    Replies:
    1
    Views:
    624
    Gabriel Genellina
    Feb 16, 2008
  4. Peter C. Verhage

    Ruby/DL SendInput

    Peter C. Verhage, May 8, 2005, in forum: Ruby
    Replies:
    5
    Views:
    324
    Peter C. Verhage
    May 9, 2005
  5. Replies:
    10
    Views:
    859
Loading...

Share This Page