![]() |
Pause a program
"I need to call a function every 1 second in my Windows (GUI) program. I have tried the following:
Code: #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." |
You need to execute a process message - you need to add a line in the while loop - telling the program to process all new input, so that it won't hang.
I have no idea how to do it in C++, in Delphi I would add: Application.Processmessages; -- I googled it and maybe you should try to add the following in the while loop: Application->ProcessMessages(); |
bump for help
|
please DO NOT post biz thread on GFY.
Thank you. |
All times are GMT -7. The time now is 01:38 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123