Solved

Delay in Borland c++ for windows

Posted on 1998-03-17
6
556 Views
Last Modified: 2008-02-01
How can i do a delay on a windows platform in Bcw?
in c++ i used delay, but it doesnt work in windows platform.

and there is another problem with my c++ for windows.
I just got it a few days, and for some reason whenever I try to run a project, from the example or another place, it makes it and then it says: could not create process

?! whats wrong ?!
thanx.. Yoli
0
Comment
Question by:yolis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1183566
If by delay you mean suspend execution of your program, you can use the Sleep() windiows API function.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183567
You specify a parameter to sleep that indicates how long you want to suspend execution in milliseconds.  Specify Sleep(500) to suspend for 1/2 second.  Sleep(1000) to suspend for a second, etc.

Can you provide more details about your make error?
0
 

Author Comment

by:yolis
ID: 1183568
thanx for the answer about the delay!
about my make problem, the problem with it that it doesnt give mt anymore details.
all that it says once it finshed making it, is: could not create process, even that the make was succesful...

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:nietod
ID: 1183569
Since it is new you can call Borland's instalation support and tell themn you think it is not installed correctly.
0
 

Accepted Solution

by:
Ant031898 earned 50 total points
ID: 1183570
Is is not a good idea to have delays in Windows code, but if you have to do it, this is one way:
you can write a function called delay:

void Delay(int delay){  //delay = time in seconds
 long time = GetTickCount();
 MSG msg;
 int quit = 0;
 while (!quit){
    if (GetMessage(&msg, HWindow, 0, 0)) {
      long timemsg = msg.time;
      TranslateMessage(&msg);
      DispatchMessage(&msg);
      if ( (timemsg - time) >= (1000*dealy) )
          quit=1;
   }
 }
}
0
 
LVL 22

Expert Comment

by:nietod
ID: 1183571
Except that does not hold up execution of a program.  (It prevents a section of code from continuing, but not the entire program.)  If you need to stop the execution of the program for a while, waiting for a hardware device, say.  That won't work as your program will still get and process messages.  The sleep function will suspend the execution of your program, but allow other programs to continue.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question