SendInput too slow

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Barb

    SendInput too slow

    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.Get WindowText( outStr );
    m_EditField.Set WindowText( "" );

    return outStr;
    }
  • Thomas Matthews

    #2
    Re: SendInput too slow

    Barb wrote:[color=blue]
    > 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++ )[/color]
    Is this a misspelling?
    Should it be inStr.GetLength ()?
    [color=blue]
    > {
    > currChar = inStr.GetAt( i );
    > simulate( currChar ); // this function outputs one char at
    > a time
    > }
    >
    > m_EditField.Get WindowText( outStr );
    > m_EditField.Set WindowText( "" );
    >
    > return outStr;
    > }[/color]

    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:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    Working...