• Advertisement

Archived

This topic is now archived and is closed to further replies.

Application programming (Windows)

This topic is 5301 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been programming games for a while now and made a few simple ones. For that I only used the most basic of win32 calls (creating/destroying a window, using alt + tab etc) but now I wish to learn to make true win apps and I''m wondering what lib to learn (first). Since I''m going to program in C++ an object oriented lib would be good. I was thinking about MFC but then I realized that it might be outdated now when the NET framework is out, anyone has an opinion of this? I don''t want to go with any of the cross platform libs, some of them seems nice enough but I don''t really need the cross platform support and I want to be able to buy a book about learning the lib I decide to use (web based tutorials are nice, but I prefer books). So basically what I''m asking is. 1) Which lib would you recommend and what advantages does it hold over the others? 2) Is there any good book you''d recommend for learning to use that lib? Thanks in advance -- Spearhawk Productions Project Andromeda

Share this post


Link to post
Share on other sites
Advertisement
WTL or roll your own.

I was working on an OO library that approached the elegance of the .NET framework yesterday, I don''t know if I''ll continue working on it at the moment since WTL does such a nice job.

My lib was inspired mostly by .NET, VB6, and the VCL:

void
MyWindow::MyWindow()
{
//initialize controls

textBox1.Size = Rect(88, 31);
textBox1.Location = Point(4, 4);
textBox1.Text = L"Hi there";

Attach(textBox1);

Show();
}


No MFC-ish virtual constructor (e.g. Create() with 10 args) needed!

Share this post


Link to post
Share on other sites
I would sugsest using .NET with c++ (c++.NET that is).
Or C#, IMHO that is the best way to do win apps with c++(or c#) especially if you use visual studio...

.:3delavnica.com:. Slovenian digital colture
Another day, another bug

Share this post


Link to post
Share on other sites
Thanks for your answers but I''m looking for arguments as to why go with one instead of the other.
From what I have gathered MFC is clumsy and blotted but it is still the industry standard, used in almost all business applications. NET on the other hand seems to be cleaner but nowhere near as widely adopted (does MS even use it for their bigger applications like Office?).
WTL looks interesting but since there seems to be no documentation other than the Codeproject''s I don''t think it''s anything for me since I want to be able to buy a book for the lib I chose to learn.



--
Spearhawk Productions
Project Andromeda

Share this post


Link to post
Share on other sites
Here's my take on it. But bear in mind that I have just started to learn MFC and are more experienced with the .NET Framework.

Anyways,

.NET has not caught on as much as expected. That's a fact. Further, Microsoft plans to support and extend MFC for quite some time. On MS's site you can read that they are planning some VC++ upgrades for the next Visual Studio release. The MS Visual C++ team is very much alive and MFC will not die out any time soon.

If you're planning on creating apps with complex GUIs MFC will be better for you. WindowForms is great, but not as evolved as MFC yet. Some claim that MFC apps run faster than .NET ones. Other claim that .NET apps run just as fast as MFC ones. I don't really know - but I guess the truth lies somewhere in the middle, i.e. you probably wont notice any differences between a MFC and a .NET application.

So, as I see it there are four major reasons for using MFC over .NET:

1. You need a complex GUI
2. You already know the MFC lib
3. Maintenacne of MFC code
4. You (or the user of the app) can't be bothered with the framework download

Reason #1 will not last for long I suspect. .NET evolves.

So, on to C# and the .NET framework. C# (and the .NET framework)is much, much easier to learn than MFC. You could also use the .NET framework with C++, but I seriously discourage that. Managed C++ is damn ugly.

MFC is old, clunky and just plain out strange. C# and .NET is MUCH more streamlined. It's easy to learn (especially if you're used to Java).

Will .NET be the future? Nobody knows. MS sure wants it to be. That's for sure. But in the years to come Win Apps will be created with either .NET or MFC (with the latter being used less and less, and at a point it will probably be used for legacy work only).

So, the reason for using .NET and C#
1. Nice, clean and a better framework than MFC
2. You already know Java (which will make C# an easy learn for you)
3. You believe the MS hype.

Now the big question: Should you learn .NET or MFC? I say both. But assuming you don't have the time for that I say go for .NET and C#. MFC is great, it really is, but it's getting archaic and bulky. .NET is very nice to work with. But really, why not learn both?

I wish you luck on your endeavours.



"Yeah, I would've killed you, but I'm glad I didn't - the paperwork is a bitch"

[edited by - rohde on August 17, 2003 8:54:16 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Spearhawk
Thanks for the info rohde! Do you know of any good books covering application programming in NET (C#)? Or for MFC for that matter (although after what you said I'm leaning more towards NET than MFC, it's good to have options).



Good books on C# and .NET:
Inside C#, Second Edition

Programming Windows with C# (Core Reference)(really good for graphics and UI).

Programming C#, Third Edition.
For application programming and GUI I recommend Windows Forms Programming with C#

For MFC Jeff Prosise is your man:

Programming Windows With MFC
(a classic).


Prosise also authored a good book on .NET, ASP.NET and web programming if that's your thing Programming Microsoft .NET



"Yeah, I would've killed you, but I'm glad I didn't - the paperwork is a bitch"

[edited by - rohde on August 17, 2003 10:40:35 AM]

Share this post


Link to post
Share on other sites
Thanks again!
I think I''ll go with "Programming C#, Third Edition". It seems to have most of the things I''m looking for (although it might be slightly light on the application programming) and I have good experience with Liberty''s other books.



--
Spearhawk Productions
Project Andromeda

Share this post


Link to post
Share on other sites
quote:
Original post by Spearhawk
Thanks again!
I think I''ll go with "Programming C#, Third Edition". It seems to have most of the things I''m looking for (although it might be slightly light on the application programming) and I have good experience with Liberty''s other books.



--
Spearhawk Productions
Project Andromeda

That''s a good book. But you''re right it''s very light on the application programming aspect of it, and it''s section on WindowsForms is tiny. The "Windows Forms Programming with C#" book is muche more loaded on that department, on the other hand it''s not a very good introdiction to C# for a beginner (unless you already know Java).




"Yeah, I would''ve killed you, but I''m glad I didn''t - the paperwork is a bitch"

Share this post


Link to post
Share on other sites
quote:
Original post by rohde
That''s a good book. But you''re right it''s very light on the application programming aspect of it, and it''s section on WindowsForms is tiny. The "Windows Forms Programming with C#" book is muche more loaded on that department, on the other hand it''s not a very good introdiction to C# for a beginner (unless you already know Java).



I got some experience in java. Mostly porting my games to it by using Gl4Java (my teacher was very inpressed with that, even though it didn''t exactly requier much skills other than cut and copy). Did very little actual java programming.




--
Spearhawk Productions
Project Andromeda

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi

If you are considering writing applications for the mass market, I would advise you to learn to program for the web using the .net framework before digging yourself too deep into the windows parts. There are many reasons for this, like easy deployment (users have web-browsers), scaling issues (just add more servers), ''automatic'' portability (web-forms work in most browsers), easy upgrades (no need to update the client, just the server), etc.

Share this post


Link to post
Share on other sites
quote:
rohde On WinForms, the .Net RAD GUI
1. Nice, clean and a better framework than MFC



Well, I can''t really say MFC is all round better, but WinForms suffers from a fundamental problem that is shared with the VCL (C++ Builder, Delphi), Swing, and VB. When you update the contents of an UI widget from code, it triggers the update event as though the user entered information. It makes writing interactive UIs more difficult, which you end with cascading update events between UI widgets on the order of n! (where n is the number of widgets that are linked) after you fix the problem the best you can using a bunch of crappy flags. It’s not nice, and not clean, and though it’s easy to get something on the screen, it’s hard to make it work right. MFC doesn''t have this problem.

The WTL suffers from a lack of documentation and examples, it’s somewhat tricky to use too, but it is a very light-weight kit compared to MFC.

I know you said you didn’t want to know about portable widget kits, but wxWindows is pretty easy to use (and has native-look-and-feel). You don’t really need a book to learn how to use it. If you want a C++ kit, it’s the best choice IMHO. If C++.Net/C# is acceptable, and you like how Swing works, then WinForms may be good choice for you.

wxWindows Example

#include <wx/wx.h>

stuct wxTest : wxApp
{
enum MenuID
{
MENU_FILE_NEW,
MENU_FILE_OPEN,
MENU_FILE_CLOSE,
MENU_FILE_SAVE,
MENU_FILE_SAVEAS,
MENU_FILE_EXIT
};

void init()
{
frame = new wxFrame(NULL, -1, SC("Hello World"));

frame->CreateStatusBar();
wxMenuBar* menubar = new wxMenuBar;
wxMenu* menu = new wxMenu;
//...

menu->AppendSeparator();
menu->Append(MENU_FILE_EXIT, "E&xit", "Terminate the application");
menubar->Append(menu, "&File");
frame->SetMenuBar(menubar);

this->SetTopWindow(frame);
frame->Show(TRUE);
}

DECLARE_EVENT_TABLE()
};


DECLARE_APP(wxTest)


IMPLEMENT_APP(wxTest)

BEGIN_EVENT_TABLE(wxTest, wxApp)
EVT_MENU(MENU_FILE_EXIT, wxTest::OnMenuFileExit)
END_EVENT_TABLE()


There a couple of RAD tools available for it too, wxDesigner and DialogBlocks.

Share this post


Link to post
Share on other sites

  • Advertisement