?
Solved

Delay in Borland c++ for windows

Posted on 1998-03-17
6
Medium Priority
?
566 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 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.

777 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