Valhalla Legends Forums Archive | C/C++ Programming | How do you create a graphical c++ program?

AuthorMessageTime
BaDDBLooD
Thanks
August 21, 2004, 10:50 PM
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().
August 21, 2004, 10:52 PM
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 :)~
August 21, 2004, 10:55 PM
Grok
[quote author=BaDDBLooD link=board=30;threadid=8291;start=0#msg76626 date=1093128924]
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 :)~
[/quote]

CreateDialog
CreateWindowEx
MessageBox

Start with those 3 Win32 API functions.
August 21, 2004, 11:11 PM
Sargera
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. :)
August 21, 2004, 11:14 PM
BaDDBLooD
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.
August 21, 2004, 11:43 PM
zorm
Grok left out RegisterClassEx which is helpful if you want the create the main dialog window with CreateWindowEx.
August 22, 2004, 5:28 PM
Myndfyr
[quote author=BaDDBLooD link=board=30;threadid=8291;start=0#msg76654 date=1093131822]
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.
[/quote]

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.
August 22, 2004, 7:11 PM
Adron
[quote author=BaDDBLooD link=board=30;threadid=8291;start=0#msg76654 date=1093131822]
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.
[/quote]

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.
August 22, 2004, 7:44 PM
BaDDBLooD
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.
August 22, 2004, 9:22 PM
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.
August 25, 2004, 9:28 PM
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/
September 2, 2004, 12:09 PM

Search