473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.GetWindowText( outStr );
m_EditField.SetWindowText( "" );

return outStr;
}
Jul 19 '05 #1
1 4842
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

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Kelly | last post by:
I have pulled together a VB.net project that hooks the keyboard (Ref. Paul Kimmel's hooking program) and allow the user to send "mouse right clicks" via the SendInpuut function (mouse emulation...
6
by: Richard A. Lowe | last post by:
I'm using P/Invoke to call SendInput (using code culled from these newsgroups!) to send mouse events to a window. But I'm unsure how to send double-clicks. A VB6 article I saw on SendInput...
5
by: Tim | last post by:
Hello All, I am writing a program that checks for the NumLock status and turns the NumLock on if it is off. I'm not sure what I'm overlooking at this point, but the code will compile and run, but...
1
by: Tim | last post by:
Hello All, I am writing a program that checks for the NumLock status and turns the NumLock on if it is off. I'm not sure what I'm overlooking at this point, but the code will compile and run, but...
2
by: Gene Vital | last post by:
Hi All, I am trying to use the SendInput API call in C# to put a keypress in the keyboard buffer and have beeting my head against the wall all morning. Could someone help me out with this, I...
0
by: fisj | last post by:
Has anyone managed to get the sendinput api to work with vb.net? I've tried converting the vb6 code from allapi.net, but its proving extremely difficult. Example and def is here: ...
2
by: kumar_subrahmanya | last post by:
Hi, I am facing problems in sending mouse clicks via SendInput API. Mouse clicks are being sent but at the X,Y co-ordinates. I am mapping my monitor to the (0,0,65535,65535) virtual monitor as...
1
by: kumar_subrahmanya | last post by:
Hi, I am facing problems in sending mouse clicks via SendInput API. Mouse clicks are being sent but at the X,Y co-ordinates. I am mapping my monitor to the (0,0,65535,65535) virtual monitor as...
7
by: Sin Jeong-hun | last post by:
Hi. I need to simulate keyboard and mouse events. For the first step, I tried to move mouse using SendInput. But it didn't work. I searched all over the internet for an example, but only questions...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.