Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delay in Borland c++ for windows

Posted on 1998-03-17
6
Medium Priority
?
580 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 100 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

610 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