Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > SendInput too slow

Reply
Thread Tools

SendInput too slow

 
 
Barb
Guest
Posts: n/a
 
      10-03-2003
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;
}
 
Reply With Quote
 
 
 
 
Thomas Matthews
Guest
Posts: n/a
 
      10-03-2003
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendInput() inconsistency between 32/64 bit function equivalents =?Utf-8?B?TWFrc2lt?= Windows 64bit 5 02-12-2010 03:55 PM
How do I use SendInput in Python? Adam W. Python 1 02-16-2008 11:45 PM
SendInput Problems Jamie Turner Windows 64bit 5 02-13-2007 06:12 PM
Problems with GenerateConsoleCtrlEvent and SendInput mike_cole@adaptec.com Perl Misc 10 11-10-2005 11:34 PM
Ruby/DL SendInput Peter C. Verhage Ruby 5 05-09-2005 05:24 PM



Advertisments