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