Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 8th, 2006, 7:18 PM   #1
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 856
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Pause a program

I need to call a function every 1 second in my Windows (GUI) program. I have tried the following:

#include <windows.h>
...
while (true) {
    Sleep(1000);
}
This works, except it locks up the application between calls so nothing else can occur.

Does C++ (or the Windows API) have a built-in pause or timer function for this purpose? Thanks.
titaniumdecoy is online now   Reply With Quote
Old Aug 8th, 2006, 7:37 PM   #2
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
This is what I got from a search on Win32 timer. This is a very common task, I am sure a cursory search of whatever docs you have, for whatever GUI framework you are using should show you its particular way of doing things.
Game_Ender is offline   Reply With Quote
Old Aug 8th, 2006, 7:59 PM   #3
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Game_Ender++

AntiNinja--
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Aug 8th, 2006, 8:00 PM   #4
AntiNinja
Hobbyist Programmer
 
AntiNinja's Avatar
 
Join Date: Jun 2006
Location: The States
Posts: 101
Rep Power: 3 AntiNinja is on a distinguished road
Send a message via AIM to AntiNinja Send a message via Yahoo to AntiNinja
I know sry, didnt read the entire post.
__________________
Pain is just weakness leaving the body.
AntiNinja is offline   Reply With Quote
Old Aug 9th, 2006, 12:41 PM   #5
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 856
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
I found the instructions that link gave were a little too complicated. This tutorial was much easier to follow.
titaniumdecoy is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Language display in program Prm753 C++ 3 May 30th, 2006 5:45 PM
Creating a program to test a program sixstringartist C 8 Jan 21st, 2006 1:15 PM
The Option Button help lpxxfaintxx Visual Basic 0 Dec 3rd, 2005 11:22 AM
How do I pause the program without counter..? boraciner C++ 17 Nov 6th, 2005 3:04 PM
move program console window back badbasser98 C++ 21 Oct 18th, 2005 2:02 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:42 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC