|
-
December 17th, 2006, 06:29 AM
#1
Two questions...
How do I get a program to do two different things at once?
Other programs seem to have two+ things happening at once...
Can I use the message thing(It's window protocol in win32) in a DOS Program?
I want the ability to display a message saying "Do you want to save first?" in my game when they click the x button...
Thanks.
Last edited by e8newallm; December 17th, 2006 at 06:37 AM.
-
December 17th, 2006, 06:59 AM
#2
Re: Two questions...
 Originally Posted by e8newallm
How do I get a program to do two different things at once?
Other programs seem to have two+ things happening at once...
If you mean threading then there's no built-in support in the language for that. You have to use platform specific libraries for that.
You can even try Boost.Threads
http://www.boost.org/doc/html/threads.html
Appreciate others by rating good posts
"Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett
-
December 17th, 2006, 07:40 AM
#3
Re: Two questions...
Thanks.
-
December 17th, 2006, 04:40 PM
#4
Re: Two questions...
How do I get a program to do two different things at once?
Other programs seem to have two+ things happening at once...
Though the above poster made a good suggestion to use the boost::threads library, I thought I should throw in my two cents here.
Unless you have multiple processors in your computer, there is no such thing as "doing two things at once." Your computer can only perform one task at a time. But, because todays processors are so fast, it is able to switch between these multiple tasks so quickly it appears that they are happening at the same time.
So if you see a program "doing two things at once", be aware that it typically is not. It is just switching between these two things so rapidly that you can't notice the difference.
In other words, use the phrase "How do I get a program to do two different things at once?" with a grain of salt, because you can really only simulate doing multiple things at once on the average desktop computer.
Can I use the message thing(It's window protocol in win32) in a DOS Program?
I want the ability to display a message saying "Do you want to save first?" in my game when they click the x button...
Well, I have never done this before, but I suppose you could.
I mean, you can use the Win32 libraries in any C++ program, so theoretically it would be possible to call the message dialog API and use it.
Consult the MSDN documentation to see how to use such API's.
Last edited by dcjr84; December 17th, 2006 at 04:44 PM.
Please rate my post if you felt it was helpful
-
December 17th, 2006, 08:54 PM
#5
Re: Two questions...
I mean, you can use the Win32 libraries in any C++ program,
I'm sure that's not accurate with respect to a DOS program, as the original question was posed.
It is possible to create slices of time in a DOS application, but it's difficult work, with LOTS of little 'gotchas' - and is probably not worth the effort (well, hasn't been since, say, 1996 or 97 at least).
dcjr84 is correct if you substitute DOS program with 'console mode' program, because the two are quite different - and all too often people have said DOS when they mean 'console app in win32' - in which case, yes, if you build the application with suitable support, you can do such things.
I get the sense, though, that the question hints at a design paradigm that should be rethought, to use from the outset a framework that supports threading, dialogs and the game's graphics, like OpenGL or DirectX.
On the point about multitasking - the simulation of simultaneous tasks in single core machines has been so close to 'real' since the Pentium 90 (and many might remember OS/2 on the higher speed 486 chips), that one can be easily forgiven for thinking of it so.
Then, too, I've had dual core workstations since 1998, and with the recent trend toward multi-core CPU's, I think the time of considering it a simulation has nearly come to an end. Soon it will be difficult to find single core machines for sale, and I'll be pricing a quad core or an 8 core machine
-
December 17th, 2006, 10:06 PM
#6
Re: Two questions...
dcjr84 is correct if you substitute DOS program with 'console mode' program, because the two are quite different - and all too often people have said DOS when they mean 'console app in win32' - in which case, yes, if you build the application with suitable support, you can do such things.
My apologies 
Naturally, I was referring to a console program when I said this.
Obviously, if you are a truly running a DOS program, then you will not be able to use Windows API's because there is no windows environment available.
Sorry for the confusion.
Please rate my post if you felt it was helpful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|