8 Replies - 1012 Views - Last Post: 24 August 2008 - 10:11 AM Rate Topic: -----

#1 Bryan Cotton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-July 08

Just getting started with C++:

Post icon  Posted 22 August 2008 - 08:17 AM

I'm just getting started learning c++ and have been learnig the basics in a dos enviorment.

I want to use c++ to make applications(that may execute dos commands or small line command dos apps) and eventual go into making games. But I'm more oncerned with windows apps or making window GUI apps out of dos line command apps..

Is it necessary to learn the dos functions and or should I just jump to Win32. I've learn the basic as far as include files and cout and cin and stiff like that.

I programming on a PC in windows using MS Visual C++ express edition to start off.

TIA!

This post has been edited by Bryan Cotton: 22 August 2008 - 12:21 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Just getting started with C++:

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3122
  • View blog
  • Posts: 19,167
  • Joined: 14-September 07

Re: Just getting started with C++:

Posted 22 August 2008 - 08:17 AM

Either or, if you want GUI apps then go with win32
Was This Post Helpful? 0
  • +
  • -

#3 Bryan Cotton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-July 08

Re: Just getting started with C++:

Posted 22 August 2008 - 10:39 AM

So with win32 apps, am I able to call dos apps and assign it commands?
For instance instead of having to learn c++ dos coding, could make a win32 c++ appp that calls say an unrar dos app and assign it file names and commands

sort of like if a dos app reuqires me to type

unrar <command> <filename to extract>

Can I make a win app that assigns the command and filen ame then call un unrar dos app. Or would i have to code the unrar app in win32 c++

I'm thinking like

Winapp Main
a=<command>
f=<file name to extract>
run unrar.exe a f ; which would exceute unrar <command> <fle name to extract>


please note that I know the unar commands and the actuall c++ syntax is off. just using it as and example.

TIA
Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Just getting started with C++:

Posted 22 August 2008 - 02:19 PM

The WinMain function is declared as:

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

The lpCmdLine argument is a pointer to the command line used to launch the application. You have to parse the line yourself. But there it is.

If you are just starting out, I recommend going the "DOS" route. The reason is that GUI programming requires a level of code that is strictly dealing with the GUI and this can confuse your code and logic.

Once you have a good grasp of how C++ works in general then you can begin to tackle the GUI.
Was This Post Helpful? 0
  • +
  • -

#5 perfectly.insane  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 70
  • View blog
  • Posts: 644
  • Joined: 22-March 08

Re: Just getting started with C++:

Posted 22 August 2008 - 04:13 PM

Just to make a clarification:

Both types are Windows programs. There are Windows GUI programs, and Windows Console programs. Both types run native in Windows, without any special DOS hacks. This is different than actual DOS programs, which run under NTVDM. A good example of a native Windows console program is cmd.exe, and a good example of a DOS program that runs under NTVDM is command.com. The difference isn't always that obvious, but your Windows Console programs have full access to the Windows API, just like a GUI application (and can even display message boxes, or display GUI windows).
Was This Post Helpful? 0
  • +
  • -

#6 dwayne  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 56
  • Joined: 02-August 08

Re: Just getting started with C++:

Posted 22 August 2008 - 06:23 PM

I suggest you start out with console apps and then add a GUI to one of them. I recently developed an entire project like that. I designed the app, made a simple console interface for debugging, and then started on a GUI for it. I'm glad I took that route as I believe that a well designed app should have no problem with a new GUI. Just keep you code well modularized, try to keep I/O in isolated functions, and keep the main function nice and tidy using it to mainly call other functions/classes. A GUI is really a task in itself, it may not seem like much but to code a complex one can take hours.
Was This Post Helpful? 0
  • +
  • -

#7 Bryan Cotton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-July 08

Re: Just getting started with C++:

Posted 22 August 2008 - 11:04 PM

View Postperfectly.insane, on 22 Aug, 2008 - 04:13 PM, said:

... Both types are Windows programs. There are Windows GUI programs, and Windows Console programs. Both types run native in Windows, without any special DOS hacks.


Ok, I think I used wrong terminoly in my orignal post. I should have never said GUI (I'm think I shouldn't have.)

I pretty much want to make apps that launch in Windows that can make use of apps that run in dos.

If what NickDmax posted refers to me being able to that then I think im good.

I pretty much want a Windows apps to be able to browse a director for a file name (and/or allow the user to input a name) then run a dos app with the file name as a parameter.

If this can be done in a windows console app, then thats what I'm looking for.
Was This Post Helpful? 0
  • +
  • -

#8 Public_account  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 37
  • Joined: 16-February 07

Re: Just getting started with C++:

Posted 23 August 2008 - 02:14 AM

You can do that by calling system("your dos program goes here").
Example:
#include <iostream>
using namespace std;

int main() {
  system( "dir" );  //an M$-DOS command to list all directories and files from a given location
  cout << "Running...";
  cin.get();
  return 0;
}


For example if the name of your program is myProgram you can run it from another program by calling
system("myProgram")

Was This Post Helpful? 0
  • +
  • -

#9 Bryan Cotton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-July 08

Re: Just getting started with C++:

Posted 24 August 2008 - 10:11 AM

View PostPublic_account, on 23 Aug, 2008 - 02:14 AM, said:

You can do that by calling system("your dos program goes here").
Example:
#include <iostream>
using namespace std;

int main() {
  system( "dir" );  //an M$-DOS command to list all directories and files from a given location
  cout << "Running...";
  cin.get();
  return 0;
}


For example if the name of your program is myProgram you can run it from another program by calling
system("myProgram")


Ok, this is what I was looking for. Thanks. I'll look up the system command and read up more on it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1