473,406 Members | 2,713 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,406 software developers and data experts.

How to update a Edit Control as fast as possible?

In my program I tried to update a edit control's text very fast, but It
seems there's no time to update it.
Following is my code. IDC_EDIT1 is a edit control;

//***************************
CString strTest;
for(int i=0;i<10;i++)
{

strTest.Format("%d",i);
CWnd* pwnd=GetDlgItem(IDC_EDIT1);
pwnd->SetWindowText(strTest);
Sleep(200);
}
//*******************************

I tried to add pwnd->Invalidate(TRUE); before Sleep(200); but it doesn't
work. Would you like to help me? I really appreicate your time and
help.

Regards,

Larry
Larry

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 28 '05 #1
3 831
You need to pump the message queue. Calling Sleep() simply freezes your
application for the duration of its call.

Brian
Dec 28 '05 #2
"larry" <la************@rogers.com> wrote in message
news:uO****************@TK2MSFTNGP14.phx.gbl...
In my program I tried to update a edit control's text very fast, but It
seems there's no time to update it.
Following is my code. IDC_EDIT1 is a edit control;
...
I tried to add pwnd->Invalidate(TRUE); before Sleep(200); but it doesn't
work. Would you like to help me? I really appreicate your time and
help.


The Invalidate method just marks the client area as need an update.

As Brian implies, when your application removes and dispatched the paint
message ( a low priority message, btw), the job will be complete.
Alternatively you can call ::UpdateWindow() after invalidate which causes a
paint message to be processed if the update region is not empty.

Regards,
Will
Dec 28 '05 #3
Thank you very much for your help. UpdateWindow() works. I really
appreciate your help.

Have a good day.

Larry

Larry

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 29 '05 #4

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

Similar topics

6
by: Sparticus | last post by:
I have a database that isn't very big. It has about 2400 rows in it. I try and do an update like this one below (it looks big, but it's really not if you look at it) : UPDATE jobs SET...
3
by: Hartmut Schroth | last post by:
Hi, I need a solution for the following problem: In the item template of a datalist control I have already a button control with the commandname set to "select" to perform some specific...
3
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I...
2
by: Ron | last post by:
Hello, I am trying to create a page that pulls class rosters from an SQLServer database. The roster table definition is: emp_id(pk, fk), sec_id(pk, fk), reg_date and reg_status. Status can be...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
3
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my...
9
bhcob1
by: bhcob1 | last post by:
Hey guys, 'Update or CancelUpdate without AddNew or Edit' On my database i keep occasionly get this error when i try and edit a field, it is not everytime. It will be working fine and then this...
7
by: =?Utf-8?B?Sm9lIFRob21wc29u?= | last post by:
Hi, I have a C# windows form application (.NET 2.0) that reads data over the serial port and displays the data via textboxes. I get a message 50 times/second. I know I can't update the screen...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.