Sign in to follow this  
harleking

Question about Windows API/SDK

Recommended Posts

I'd like to start programming windows applications, but I'm a little confused. I already know C++, but I've only used my programs through the command prompt. I don't know what the next step is. I'm trying to figure out which is the library that I need to use to create windows, buttons, menu bars etc. I know there is the Win32 API and the Windows SDK, but I don't know the difference between them (and thus, which one I'm supposed to read about). Any help is appreciated. (By the way, I don't want to use WYSIWIG tools like visual basic--I've used them before, and I don't like them).

Share this post


Link to post
Share on other sites
While you certainly can use C++ to create Windows applications with menus, etc., the trend that seems to be prevelent is to use VB.net or C#. I'm not sure if you have tried any of these tools but what ever it was that turned you off to WYSIWYG tools may very well be resolved by these more modern languages - especially C# (since you are coming from a C++ background).

Share this post


Link to post
Share on other sites
Thanks for the responses!

I know that .NET will make programming these applications easier, but I rather not have to learn another programming language (C#) since I just recently really began to be proficient in C++ (and I'd hate to start over again!). I'm also not fond of the idea of paying hundreds of dollars for the development tools. I'm a student and can't afford to spend that kind of money.

I read a little about the Microsoft Foundation Classes in wikipedia and it says there that these are Windows API portions wrapped in c++ classes. That seems to be more like what I needed. So I'm assuming the windows API is the one that defines windows, menus etc. What exactly, then, is the Windows SDK?

Share this post


Link to post
Share on other sites
If you're interested, you can download Visual Studio Express Editions for free to try things out. I understand your feelings about learning a new language. But I found that once I learned one language, learning new ones was not nearly as hard. Of course, that doesn't mean that you would be proficient in all of them. We tend to be best at what we are currently using. I also certainly don't want to sound like a salesman for Microsoft, there are lots of free tools to download. VS Express tools are just really good tools to work with - especially the debugging tools. There's also a VC++ Express included. Not sure what your using for an IDE. Again, we're most proficient and comfortable with what we are currently using.

If you want to use the Windows SDK, this link will give you some good information.

Share this post


Link to post
Share on other sites
I second what others have said about .NET - you can use C++ to work with .NET (though personally I consider it something of a monstrosity when languages like C# are available). That said I also appreciate your situation, and continuing with the Win32 API is OK, you just need to bear in mind at all times that there are nicer alternatives available.

The difference between the Win32API and the Windows SDK:

The Win32 API is a collection of functions, constants, structures, and definitions that programs can use to communicate with the Windows operating system. There's a function to create a window, a function to set the cursor, a function to play a sound, and so on. Note that the API itself isn't a concrete thing you can download or something - it's more like a standard that the OS conforms to.

The Windows SDK is a collection of headers, libraries, documentation, and sample code, that assist you in writing C or C++ code that uses the Win32 API. All the information about the signatures of the functions and the DLLs in which they reside is recorded. All the constants and structures are laid out. Instead of having to set things up in your own code, defining all the constants and stuff yourself, you use the SDK as a shortcut. (The number of symbols that the SDK defines for you is easily in the thousands, which is why everybody uses it instead of trying to do things by hand).

For the most part, the two terms are used interchangably; "Programming with Win32" and "Programming with the Windows SDK" generally mean the same thing, which is writing code that calls into Windows via the functions defined in the Win32 API, with your code assisted by the Windows SDK.

Share this post


Link to post
Share on other sites
<Offtopic>
It's interesting to see that in most threads were people ask for help with a language they have decided to use there are always people to tell them to change language :P
</Offtopic>

Share this post


Link to post
Share on other sites
Imo, that observation seems somewhat on topic...

Here are a couple of books to get started with programming on windows.

Programming Windows, Fifth Edition. This is a classic. It uses C not C++ but that shouldn't be too much of a problem for you.

Programming Applications for Microsoft Windows (or Advanced Windows) Both of these are the same book, the author changed the name between the 3rd edition and the 4th edition. The 4th edition uses C++, the 3rd edition uses C. Amazon says the 4th edition isn't available but the 3rd edition is. That's just as well, I think the 3rd edition was better.

Getting a copy of the Platform SDK is a good idea too.

Share this post


Link to post
Share on other sites
Once again thanks for the responses, you guys have been very helpful.

I'm going to take a look at the c++ resources, but I'll also give a quick look at C#. If that's where the trend is going, I'll probably have to learn it sooner or later. (oh well...)

Share this post


Link to post
Share on other sites
MFC is most powerful on Windows. ".NET" is a bit simpliest,however well written program in MFC is better with quality,speed etc.

MFC is not a part of VS Express. For some reasons this is only a part of full VS2005/2003/etc.

( I don't wonder why,since most of quality apps I know is written in this api even now,I think... )

Share this post


Link to post
Share on other sites
i recomend you learn SDL. It's alot easier to use than Win32, plus it has faster input and graphics. The applications made for SDL will look just as professional as win32 apps, and they'll be more portable.

Share this post


Link to post
Share on other sites
I'm still debating whether to make the move to C#, but I have a few questions:
1. What makes programming windows applications easier in C# than C++?
2. Given that C# is so tied to the .NET framework, doesn't that make it pretty much a windows-only programming language? I'm aware of the irony of wanting to learn the windows SDK and then complaining about C# being so plataform specific, but my concern is that if I'm going to learn a whole new programming language, I'd like to be able to use those skills in other platforms. Considering it's microsoft, I'm afraid that they might integrate it so much to their OS that using it for other purposes won't be useful.

Share this post


Link to post
Share on other sites
Quote:
Original post by harleking
1. What makes programming windows applications easier in C# than C++?
Mainly the fact that working with the .NET framework is generally nicer when using a language that was designed for it (C#) instead of a language that has been bent until it roughly fits (C++). The .NET framework is by far the easiest way to make Windows UI-based applications at the moment.

Quote:

2. Given that C# is so tied to the .NET framework, doesn't that make it pretty much a windows-only programming language?
Not at all. Check out the Mono project.

Share this post


Link to post
Share on other sites
MFC is still used a lot, but its future does not seem bright. It also sort-of assumes that you will create your windows through the GUI builder in Visual Studio.

If I were to write a GUI in C++ on Windows, I'd use plain Win32. Start by reading the "Windows Interface" section of MSDN.

There is a light-weight template library that may help in the creation of standard Windows programs, called WTL. However, it is pretty poorly documented, and the tutorials I've found aren't that great.

The main thing to remember is that, in Windows, a "window" is anything that renders on the screen. What you move, as a user, is a "top-level" or "frame" window, but the menu bar, the buttons, the edit boxes and all the other controls are also "windows" in Win32 terminology, and created using CreateWindow() (or more likely, CreateWindowEx()).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this