In a console is there..

This is a discussion on In a console is there.. within the Windows Programming forums, part of the Platform Specific Boards category; I am making a program and I am wondering if it is possible to run more than 1 process at ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    673

    In a console is there..

    I am making a program and I am wondering if it is possible to run more than 1 process at a time in a console program. What I mena is like to have a Message box constantly animating (through a loop) and have other code running at the same time. Just wondering if I am going to have to learns WIN32. thanks for the help ( and I cant give any source code because I dont have any yet ) I have tried writing it different ways but all same outcome it runs one block of code then passsing to the next. Thanks again

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I don't know what you mean by having a "Message box constantly animating" but it sounds like you might want to look into multithreading, although it is a somewhat advanced topic.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    ok here is a really simple way to ask, is there anyway to run two .cpp at the SAME time?

    EDIT: Even if there is a way to have 2 consoles open working with the same program would be great
    Last edited by Raigne; 06-23-2006 at 06:42 PM.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    903
    Having two .cpp files run at the same time means absolutely nothing. What do you want to do ? I'm sure we might find an easy way to achieve your goal... Either way, you might want to look at CreateThread() and TerminateThread() as well as InitializeCriticalSection(), BeginCriticalSection() and EndCriticalSection(). Look them up MSDN.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Lets I am trying to figure out a way to make something like a GUI in a console ( just trying to learn new stuff ) I know a little about multithreading but it isnt going to help here. If anything I can start learning WIN32 but that kinda trails away from C++ which is the language I like the most. Also if it makes any diffrence I am use the Code::Blocks IDE

  6. #6
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Maybe this can be of some help Adding Windows to a Console Application

  7. #7
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    That program on that site will not work... it uses the function
    Code:
     void main(arg_type)
    as most people know main() cannot be void because it has to return an integer ( if you can tell me how to get around that then that would work great otherwise I cant use it thanks in advance

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    903
    Simply change "void main(arg_type)" to "int main(int argc, char** argv)". Your compiler should support both for compatibility with C but you should highly prefer int main over void main.

  9. #9
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    hmm now the program fails to create dialogue box for some reason any Ideas?

  10. #10
    Registered User
    Join Date
    May 2006
    Posts
    903
    You probably don't have the resource file.

  11. #11
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    I have all nescessary files ( downloaded from site) and I get errors saying no such functions on the function HWNDhWnd. all my errors are occuring becuase of that function being invalid.

  12. #12
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Quote Originally Posted by Raigne
    Lets I am trying to figure out a way to make something like a GUI in a console ( just trying to learn new stuff ) I know a little about multithreading but it isnt going to help here. If anything I can start learning WIN32 but that kinda trails away from C++ which is the language I like the most. Also if it makes any diffrence I am use the Code::Blocks IDE
    You are a little confused... WIN32 is a programing interface, a set of libraries basically, you are still programming in C++.

  13. #13
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    just seems like WIN32 is so hard to use lol

  14. #14
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    If you aren't used to classes and what not it can be, you may want to learn a couple simpler APIs and/or some other languages. I had a REALLY hard time with Win32 API months ago, I had to stop most of my C++ programming due to a new job and needing to learn Perl, Java, PHP, and SQL... Learning other languages taught me to apply the same concepts in other forms, which made learning other APIs far simpler.

    Though some people learn better if they focus on just one language, so up to your learning style.

  15. #15
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    ok I got the WIN32 figured out ( lol I studied up ALOT)
    but in this line of code
    Code:
    data = CreateWindow(TEXT("EDIT"),NULL,WS_CHILD|WS_VISIBLE|WS_BORDER|ES_LEFT|ES_NUMBER,0,0,240,250,hwnd,(HMENU)ES_READONLY,hThisInstance,NULL);
    what is the ES_READONLY called ( i want to search for other things to put there on MSDN but I dont know what to search for )

    EDIT:
    Can someone tell me how to display variables in WIN32, I keep getting errors when trying to use them (I know it is my syntax ) so can someone show me a example of correct syntax. I searched MSDN but I was obviously not looking for the right thing so thank you in advance.
    Last edited by Raigne; 06-24-2006 at 04:41 AM.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Console, Terminal and Terminal Emulator
    By lehe in forum C Programming
    Replies: 4
    Last Post: 02-15-2009, 08:59 PM
  2. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 09:59 PM
  3. Problems with a simple console game
    By DZeek in forum C++ Programming
    Replies: 9
    Last Post: 03-06-2005, 01:02 PM
  4. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 02:44 AM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 09:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21