win32 programming?

Started by
20 comments, last by daviangel 15 years, 11 months ago
Quote:Original post by Ultimape
I believe windows api uses "wide characters" (wchar)... which is basically their own version of unicode.


Win32 uses UTF-16. A wide character is a datatype which is more than one byte and is meant to store a character.
Advertisement
Quote:Original post by Spoonbender
One word. Don't. [wink]

There is really no magic in it. First, in Windows applications, the main function is replaced by WinMain for historical reasons. That should allow you to create a win32 application although without any windows or graphics.

......

But don't rush it. You won't lose anything by staying in the text-based world a while longer. The big sticking point is always how well you know programming, and that's the same whether or not you have a graphical component to your programs.


Well said. It took me much more than a few days to come to grips with C++ itself.

Think of libraries and windows and graphics as merely things done with C++, not functions/features of C++.

The core thing here is to know C++ first. Experiment with bitwise operations, pointers, learn templates and try out some of your own template classes and functions. Learn a bit about function pointers, references, complex math; teach yourself about pointer arithmetic, using logic operations in equations, virtual classes, inheritance, function overloads, string manipulation such as concatenation, splitting up strings, learn how to use STL and all of the different types of containers that C++ can help you create and use in your programs. Read articles on slimming down code (especially logic and function calls), optimising operations and memory usage, refactoring large chunks of code, when and how to use dynamically allocated memory, how to track the memory you use and how to diagnose problems with the performance of your code.

One other thing if you haven't learnt it yet is the actual physical layout of memory in all your integers, floats and strings. Understanding the binary layout of computers will greatly help you down the track with more complex areas such as optimisation and memory reduction.

Thats a little hint to the scope of what the language is all about without delving much into what to use it for. Don't ride a bike without knowing how it works!
NT isn't really UTF-16. In normal Microsoft fashion they decided to only implement parts of the standard encoding. I know the earlier versions of Windows didn't support surrogate pairs. NT4 doesn't support them at all, not sure if with 2000 surrogate support is enabled by default, XP GDI also had issues with surrogates and may still? There's probably other differences as well but I've been fortunate to not venture outside of the western range. Probably the reason why they decided to call the encoding wide character encoding.
Quote:Original post by Gage64
I recommend that you stay away from the Win32 API as it will just give you a lot of headaches. If you want to use "real" graphics and program 2D games, I recommend that you take a look at SDL which is much easier to use than Win32.


Is it a joke ?
SDL is for kids only, who don't know anything about programming .
With win32 api, you can do *everything*
"real graphics" has no sense at all. SDL is just a wrapper !
With GDI/GDI+ tou can do everything in 2D.
With DirectX, you can do everything in 3D.
Read the Petzold and MSDN.

Quote:Original post by paul23
Thanks for the advice: the problem is that I can't really think of much to program with only the command line (and files) output (cout,cin). Made a few small things already: like a sorting algorithm of data in files (only using arrays/made my custom bubble sort), some string modify functions (well character-array - modify functions) and a small guess-the-number game

Could make a hangman game. Or an app that prints out the name of every .txt file on your harddrive. Or a database of all your CD's. Or any of a million other things. Or just go back and read some more about the C++ language. There's plenty you still don't know. Learn new features, then try to use them.

Ultimately, input and output (whether it's cout and cin, or file streams, or in GUI apps, the current mouse position, or the "you just clicked the 'ok' button" event) aren't all that interesting. They're just ways of getting data into your application.
The hard part is in the logic for working with that data. And that's what you need to practice.
Quote:Original post by george135

Is it a joke ?
SDL is for kids only, who don't know anything about programming .
With win32 api, you can do *everything*
"real graphics" has no sense at all. SDL is just a wrapper !
With GDI/GDI+ tou can do everything in 2D.
With DirectX, you can do everything in 3D.
Read the Petzold and MSDN.


I sure hope you aren't serious...

I must be the only person here who's going to suggest learning Java. Java is great for making Win32 applications with real GUIs. The best part of Java is that it's platform-independant, so the exact same code will run in Windows, Linux, MacOS, Solaris, or any other OS with Java on it. Java's not all that difficult to learn if you've learned the basics of C++. Also, if you're going to create Win32 apps in Java, use Eclispe with the proper GUI Editor. It gives you a simple drag-and-drop interface for making GUIs. All you have to do is add listeners so you can interact with the objects.
Quote:Original post by ValdermanI think it sounds just awesome to be a voter in the U.S. It always seems that you're choosing between Hitler, Stalin and Jack the Ripper.
Quote:Original post by jalexbrown
I must be the only person here who's going to suggest learning Java. Java is great for making Win32 applications with real GUIs. The best part of Java is that it's platform-independant, so the exact same code will run in Windows, Linux, MacOS, Solaris, or any other OS with Java on it. Java's not all that difficult to learn if you've learned the basics of C++. Also, if you're going to create Win32 apps in Java, use Eclispe with the proper GUI Editor. It gives you a simple drag-and-drop interface for making GUIs. All you have to do is add listeners so you can interact with the objects.
No, I'll agree with you. One thing, though:

Quote:Java is great for making Win32 applications with real GUIs.
Then, by definition, they're not Win32 programs.

Had I made the recommendation I'd say C#, as the tools are generally more enjoyable to use and I consider the language itself, if not the BCL, a little more straightforward, but they're close enough to be recommended in the same breath. C#'s WinForms GUI support is far, far better than anything Eclipse has, too, and the GUI process is, I think, conceptually easier with events/delegates than with listeners.

Starting with C++ kind of sucks. When you should be learning the concepts, instead you're stuck fighting with syntax. It generally seems to be a lot easier to start with a more modern language and work backwards.

Good luck to the OP!
http://edropple.com
Quote:Original post by jalexbrown
The best part of Java is that it's platform-independant, so the exact same code will run in Windows, Linux, MacOS, Solaris, or any other OS with Java on it.


Fair point, but so will the .NET languages eventually [smile].

Quote:Original post by EasilyConfused
Quote:Original post by jalexbrown
The best part of Java is that it's platform-independant, so the exact same code will run in Windows, Linux, MacOS, Solaris, or any other OS with Java on it.


Fair point, but so will the .NET languages eventually [smile].
.NET has many problems on other operating systems that Java does not (I vastly prefer .NET/Mono, to the point of working for Mono this summer, and I'll still admit that).

-Sockets are full of Win32isms. (They return Winsock error codes, among many other leaky abstractions.)
-System.Management? Really? Ahoy there, Win32isms...
-Basically about a third of the System namespace should be in Microsoft.* but isn't, and makes for some pretty gnarly programming off Windows.

If you're using Windows, and expect others to do so, C# is a smart choice because it maps very well to Win32. Otherwise, C# loses a lot of its appeal (both in having APIs that are more than a little bent and in not having an IDE as good as Visual Studio; MonoDevelop is progressing, but I don't think it's there yet).
http://edropple.com

This topic is closed to new replies.

Advertisement