3 Replies - 626 Views - Last Post: 10 March 2009 - 09:54 PM Rate Topic: -----

#1 cyphen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 05-March 09

Windows Programming... which API?

Post icon  Posted 10 March 2009 - 08:22 PM

Okay, so i'm looking at getting a little more into windows programming now. I've done a little before with Windows Forms, and a little with Win32 while investigating DirectX... So now, i've got a question... which API should i go with? I'm not even sure i understand the difference between them all...

From what i can tell, Windows is all Win32... which they've since called the Windows API? (because it also supports old 16 bit code, and new 64 bit code...)

The problem with this was a lot of dispersed functions, and tedious coding... which is where MFC comes in... Also, is Win32 all C-based code, and does the MFC interface with that in a structured set of C++ Classes? If so - doesn't MFC basically just convert back to Win32? So the benefit of MFC would be all the developed classes, right?

Okay, then there's .NET which is managed code... it runs on top of the .NET subsystem, right - which polices the applications? Only doesn't this limit your ability in programming - for instance when writing device drivers, or DirectX - where you want direct access to hardware?

I don't even know what other things are out there as an option... i think those are the main ones for windows... but don't they all boil right back down to interfacing with Win32? Meaning that there would be extra steps taken by the interface?

Now, i'm using Visual C++ Express Edition 2008, so i don't really have the option of MFC... but if MFC is the way to go, maybe i'll buy the standard edition. If there's no real reason to, then i won't.

My question is - should i use Win32 and learn that, mixing it with C++ code? Should i concentrate on learning Windows Forms? Can you program DirectX in Windows Forms?

Just seeking a little guidance! Also, if there are some good tutorials out there - or a learning path for whatever is recommended, that would be awesome!

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Windows Programming... which API?

#2 mike_jensen  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 2
  • Joined: 10-March 09

Re: Windows Programming... which API?

Posted 10 March 2009 - 08:44 PM

You're right - MFC is just an object-oriented wrapper around the Win32 API. There is probably a slightly steeper learning curve if you want to learn the Win32 API than MFC; you'll get more help with Auto Complete because you'll be able to type CWnd.Show(..) instead of having to remember ShowWindow(hwnd). That said, there is a certain amount of baggage you have to put up with if you go with MFC; it's hard to mix MFC libraries with non-MFC libraries for instance. I learned MFC first and Win32 afterwards, and when I get the chance I stick with Win32 now.

If you're into hard-core 3D games or something calculation intensive like image processing, you'll want to go with C++'s access to Direct X. If you're doing more low-key business apps then why not consider C# for Windows Forms? In my opinion managed C++ is just a hassle since, as you point out, all the cool stuff is unmanaged anyway. Windows Forms is dead easy with C#. There's no reasonably easy way to do Direct X from Windows Forms, but you get access to some of Direct X's functions through C#'s WPF (with more on the way in future versions).
Was This Post Helpful? 1
  • +
  • -

#3 cyphen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 05-March 09

Re: Windows Programming... which API?

Posted 10 March 2009 - 08:56 PM

Awesome - thanks much! I'll stick with Win32, then... particularly since it seems MFC is a dead end...

I've done some Windows Forms C# and you're right... it is pretty easy... and there's a TON of good documentation... but for certain things i want to do - like DirectX apps, it just didn't seem like the right way to go...

Any good structured tutorials or courses you recommend?
Was This Post Helpful? 0
  • +
  • -

#4 webboy42  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 17-August 08

Re: Windows Programming... which API?

Posted 10 March 2009 - 09:54 PM

I have used both the Win32 API and .NET, there are some ocasions where I prefer .NET over win32, but others where it is the reverse.

For prototyping new ideas I like .NET, but when I'm doing something serious that I want to be able to distribute with as little hassle as possible, I prefer Win32 since I do not have to provide a bootstrapper for people who don't have the .NET framework. Besides, have you seen how fat the .NET framework is? With .NET framework 2.0 just one of its DLLs was 10MB, and most of that code you'll never use.

There is a managed directX wrapper, but it only provides a small subset of directx functionality.

Also, the portability of well written C++ code can't be beat.

My stratogy of late when dealing with the win32 API is to create classes with the absolute minimum of functionality you need, and breaking that up into resources that can be managed. For example, for TCP functionality I broke the functionality into winsock initialization/cleanup, socket handle initialization/cleanup, and high level classes for a listener or client. All those components only have functions I need now, not just all the functions I might need in the future.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1