Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: BaDDBLooD on August 21, 2004, 05:50 PM

Title: How do you create a graphical c++ program?
Post by: BaDDBLooD on August 21, 2004, 05:50 PM
Thanks
Title: Re:How do you create a graphical c++ program?
Post by: Yoni on August 21, 2004, 05:52 PM
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().
Title: Re:How do you create a graphical c++ program?
Post by: 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 :)~
Title: Re:How do you create a graphical c++ program?
Post by: Grok on August 21, 2004, 06:11 PM
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.
Title: Re:How do you create a graphical c++ program?
Post by: Sargera on August 21, 2004, 06:14 PM
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.  :)
Title: Re:How do you create a graphical c++ program?
Post by: 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 window with a few things.. text box.. etc... maybe a few comments as well.
Title: Re:How do you create a graphical c++ program?
Post by: Zorm on August 22, 2004, 12:28 PM
Grok left out RegisterClassEx which is helpful if you want the create the main dialog window with CreateWindowEx.
Title: Re:How do you create a graphical c++ program?
Post by: MyndFyre on August 22, 2004, 02:11 PM
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.
Title: Re:How do you create a graphical c++ program?
Post by: Adron on August 22, 2004, 02:44 PM
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.
Title: Re:How do you create a graphical c++ program?
Post by: BaDDBLooD on August 22, 2004, 04:22 PM
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.
Title: Re:How do you create a graphical c++ program?
Post by: Zakath on August 25, 2004, 04:28 PM
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 (http://dmbot.valhallalegends.com/samplewin32.zip).
Title: Re:How do you create a graphical c++ program?
Post by: LordVader on September 02, 2004, 07:09 AM
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/