• Welcome to Valhalla Legends Archive.
 

How do you create a graphical c++ program?

Started by BaDDBLooD, August 21, 2004, 05:50 PM

Previous topic - Next topic

BaDDBLooD

There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Yoni

Graphical can mean many things. It depends on the intended operating system, programming environment, application programming interfaces used, etc. There is no universal "standard" for graphics in C++. So I will assume you work with Borland Turbo C++ for DOS:

#include <graphics.h>
Press F1 to see documentation for initgraph().

BaDDBLooD

Sorry, i could have explained this better.

I am using Visual C++ 6.0

I Know how to create Console applcations, and i know some c++ syntax / functions etc..

I wanted to know how to use just a plain win32 application not Console.  Have graphical "forms", as refered to in Visual Basic.

Thanks for the fast reply though yoni :)~
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Grok

Quote from: BaDDBLooD on August 21, 2004, 05:55 PM
Sorry, i could have explained this better.

I am using Visual C++ 6.0

I Know how to create Console applcations, and i know some c++ syntax / functions etc..

I wanted to know how to use just a plain win32 application not Console.  Have graphical "forms", as refered to in Visual Basic.

Thanks for the fast reply though yoni :)~

CreateDialog
CreateWindowEx
MessageBox

Start with those 3 Win32 API functions.

Sargera

#4
Though experimenting with those functions Grok provided may be a good start, you're never going to be able to make an interactive program with them and your code.  You'll need to learn how the Win32 API works as far as creating a GUI (such as device handlers, and message loops).  http://www.gametutorials.com/Tutorials/Win32/Win32_Pg1.htm is a good place to start learning those types of things.  If you're interested in creating the GUI in a very VB-ish manner, you can use the Microsoft Visual C++.NET Resrouce Editor; though if you don't know what you're really doing, it can get messy and confusing in a hurry.

I'm not sure if this is true, but because VB implements the Win32 API to create its own GUIs, perhaps similar methods that you use in VB can be applied to C++.  However, I doubt this is true.  :)

BaDDBLooD

#5
Well most of that was for .NET, but i did dl some of them.  I was looking for more of a Example window with a few things.. text box.. etc... maybe a few comments as well.
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Zorm

Grok left out RegisterClassEx which is helpful if you want the create the main dialog window with CreateWindowEx.
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

MyndFyre

Quote from: BaDDBLooD on August 21, 2004, 06:43 PM
Well most of that was for .NET, but i did dl some of them.  I was looking for more of a Example form with a few things.. text box.. etc... maybe a few comments as well.

1.) If you're using Visual C++ .NET, you can make an MC++ Windows Forms application, just like in VB.NET.  That is a project type when you're creating a new project.

2.) If you're using Visual C++ .NET and want to do things the right way (that is, not use MC++ because it sucks), you'll have to make a Win32 application.  You probably won't get a very robust "Form" in the manner that you're thinking of.  C++ wasn't made for visual design, and while some macros support it, if you don't understand what the macros do, you'll be up a creek without a paddle.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Adron

Quote from: BaDDBLooD on August 21, 2004, 06:43 PM
Well most of that was for .NET, but i did dl some of them.  I was looking for more of a Example form with a few things.. text box.. etc... maybe a few comments as well.

Use the resource editor to make a dialog, write a dialog procedure to handle the "events" (window messages), and CreateDialog to make it a non-modal form.

BaDDBLooD

#9
I can make a Console application in VC++ 6.00  But not in VC++ .NET.  Anyone got an idea why?

EDIT: Nevermind, iago helped me fix the problem.
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Zakath

I have a short tutorial that shows how to code a 'form' in C++ using the Windows.h library, and DM has one as well. I don't have internet access on the system containing said tutorial (yet), but feel free to take a look at http://dmbot.valhallalegends.com/samplewin32.zip.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

LordVader

Heh, im learning this as we speak  :P
This link if you follow the steps from start to end will teach you the different methods of creating windows (CreateWindowEx) dialogs (Dialog) and you will learn the api // methods completely by the time your done is not to hard to follow with a few read thru's..

http://www.winprog.org/tutorial/