I need help with Windows programming

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Jeraden

Platinum Member
Oct 9, 1999
2,518
1
76
Well I was just answering the guy aboves question. Yeah, you need .net to run it. I'm not sure if you can even install that on 98.
 

Apathetic

Platinum Member
Dec 23, 2002
2,587
6
81
Originally posted by: zephyrprime
If you want to use any DirectX, you should avoid C and use C++ or some other object oriented language. Although it's possible to make programs in C for windows, Windows API's really assume that you're using something that has the OO abilities of C++.

By the way, making even a small game is not at all easy. You should look into using a game API if you're really intested in this.

Actually, the Win32 API wouldn't know what to do with a C++ class/object. All the APIs were written in C and assumed C (or something that can generate a C style function call) would be used.

Dave
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: singh

Most game tutorials/books on the Windows platform will be for a Visual Studio user. You will have to jump through a lot of hoops to work with other compilers.


A lot of said game books also include a "trial" (well, not the right word.. "limited" maybe?) version of VS.. or at least VC++
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: Apathetic

Actually, the Win32 API wouldn't know what to do with a C++ class/object. All the APIs were written in C and assumed C (or something that can generate a C style function call) would be used.

Dave

Well, that's sort of a half truth.. there are definately some aspects of OOP in the raw Win32 API, living within the constraints imposed by C. One of the first things you do is "register a window class" sounds a lot like OOP to me, doesn't it?

MFC provides wrappers that hide a lot of the tedious (and sometimes nasty) parts of the API so you can program in C++..

Why anyone would program games in Java or VB is beyond comprehension.. unless you're doing a card game or something, performance is just not there. C# may be a bit better (havn't tried), because it compiles to a native executable the first time you run the program..
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: jediknight
Why anyone would program games in Java or VB is beyond comprehension.. unless you're doing a card game or something, performance is just not there.

That's not true at all. In fact, for a game as simple as the original poster is describing (2D, SNES-style graphics), I can't imagine why you would go through the trouble of learning MFC/Win32 API/DirectX. Swing is far more intuitive and can produce some impressive results.

Java's reputation as a slow performer is outdated. Java Virtual Machines have been performing well for years now.

C# may be a bit better (havn't tried), because it compiles to a native executable the first time you run the program..

C# does not compile into a native executable the first time you run it. A C# executable is actually .NET byte code that requires the .NET Framework to manage and execute it.
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: MrChad
That's not true at all. In fact, for a game as simple as the original poster is describing (2D, SNES-style graphics), I can't imagine why you would go through the trouble of learning MFC/Win32 API/DirectX. Swing is far more intuitive and can produce some impressive results.

Java's reputation as a slow performer is outdated. Java Virtual Machines have been performing well for years now.
I guess for small projects it's OK.. but it really doesn't scale well if you want to do anything of any signficance.

C# does not compile into a native executable the first time you run it. A C# executable is actually .NET byte code that requires the .NET Framework to manage and execute it.
As I understand it from a presentation on .NET a year or two ago I attended (maybe out of date by now..), when you compile to .NET, it generates MSIL bytecodes. When you run the program, the IL is compiled into an executable. The devil is in the details, though, and I might have missed something..
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
Originally posted by: jediknight
Originally posted by: MrChad
That's not true at all. In fact, for a game as simple as the original poster is describing (2D, SNES-style graphics), I can't imagine why you would go through the trouble of learning MFC/Win32 API/DirectX. Swing is far more intuitive and can produce some impressive results.

Java's reputation as a slow performer is outdated. Java Virtual Machines have been performing well for years now.
I guess for small projects it's OK.. but it really doesn't scale well if you want to do anything of any signficance.

C# does not compile into a native executable the first time you run it. A C# executable is actually .NET byte code that requires the .NET Framework to manage and execute it.
As I understand it from a presentation on .NET a year or two ago I attended (maybe out of date by now..), when you compile to .NET, it generates MSIL bytecodes. When you run the program, the IL is compiled into an executable. The devil is in the details, though, and I might have missed something..

.Net MSIL is compiled to native code by the .Net JIT (Just-in-Time) compiler prior to executing the application and that compiled code is then cached for future use.

The Sun Java HotSpot VM compiles some java bytecode to native code before executing, then using intelligent profiling compiles the most used sections of code and the sections of code that can get the greatest benefit from being run in executed mode instead of interpreted. Using the usage-profile the HotSpot VM also optimizes the compiled code based around the usage pattern. All the compiled code is then cached for future use by the VM. This is why the fourth of fifth time you run a java application it can appear to be faster than the first, because it is!

Now that we have that out of the way, yes java applications can scale just fine. Just like any large project, if you actually use your brain while developing it, the end product will come out quite nice. There are some more advanced techniques to allow java applications to scale, and no, your "Learn Java in 24 Hours" book won't cover them. Things like object-pooling instead of always creating objects, thread-pooling vs. 8 billion worker threads, and understanding the swing event model all play key rolls in how your large java application behaves. Given that you don't think java scales well, I doubt you are familiar with most of these techniques.

Intelligent code will always beat sloppy code, regardless of language.
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: Kilrsat
Now that we have that out of the way, yes java applications can scale just fine. Just like any large project, if you actually use your brain while developing it, the end product will come out quite nice. There are some more advanced techniques to allow java applications to scale, and no, your "Learn Java in 24 Hours" book won't cover them. Things like object-pooling instead of always creating objects, thread-pooling vs. 8 billion worker threads, and understanding the swing event model all play key rolls in how your large java application behaves. Given that you don't think java scales well, I doubt you are familiar with most of these techniques.

Intelligent code will always beat sloppy code, regardless of language.

That is, of course, very true. Personally, I'm much more into C++ programming (I find some of the "Sun knows best" features/exclusion of features in Java quite restrictive and annoying..).. So, for performance, I can only go by what I know of in terms of real world examples of significant applications.

This isn't exactly an apples-to-apples comparison (I don't even have any real hard data), so this might be questionable.. but I'll go ahead with it anyway. Let's compare a few pieces of software, written in Java vs. C++, and see the performance difference.

1) Star Office (older version of ~1-2 years ago - I don't know how well it performs now) vs. Microsoft Office
SO runs quite a bit slower than MS Office, in my experience.

2) Sun ONE Studio vs. Microsoft Visual Studio
Again, the Java program runs quite a bit slower (VERY noticable on my rather slow machine), and is more resource intensive.

This isn't really a persuasive argument, I'll admit.. but I can't go much farther without going into a lot more detail about language features, etc (of which I'm liable to make a few errors/omissions)..
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Originally posted by: Chaotic42
Originally posted by: Jeraden
There's a free C# ide called SharpDevelop:
http://www.icsharpcode.net/OpenSource/SD/

Download that, the .net SDK, and the DirectX sdk for C# and you are all set to go and doesn't cost you a thing.

So I'd have to install .net, learn C#, and then get everyone that will use the program to install .net? That sounds like a bit of work. Also, keep in mind that one person uses a 333 Celeron with Win98.


C# shouldn't be that hard. Plus you could play around with Mono, and DotGNU. Seems like the "next big thing". If things continue the way they are going Linux will be the first real .net platform before even Longhorn gets out. Learning C# can give you a leg up on this next stuff.

Mono is close to getting complete, they've moved out of Beta stage and have the first RC release out

Or just stuff it all and use C or Python or Java or whatever with SDL and get it done. Then you can program it on whatever platform you want, use Wine to test Windows compatability and then have fun. There is a project working on SDL binding for .NET but I don't know much about it.

here is some screenshots. One includes using the Eclipse IDE stuff, along with debuggers and document browsers
 

Vee

Senior member
Jun 18, 2004
689
0
0
Originally posted by: zephyrprime
If you want to use any DirectX, you should avoid C and use C++ or some other object oriented language. Although it's possible to make programs in C for windows, Windows API's really assume that you're using something that has the OO abilities of C++.

By the way, making even a small game is not at all easy. You should look into using a game API if you're really intested in this.
I don't know anything about DirectX, but Windows API is fine with C. If you're going to use any class library though, it would help a bit with some C++.

Edit: - Sigh. Should have read the entire thread... of course.
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
Originally posted by: jediknight
Originally posted by: Kilrsat
Now that we have that out of the way, yes java applications can scale just fine. Just like any large project, if you actually use your brain while developing it, the end product will come out quite nice. There are some more advanced techniques to allow java applications to scale, and no, your "Learn Java in 24 Hours" book won't cover them. Things like object-pooling instead of always creating objects, thread-pooling vs. 8 billion worker threads, and understanding the swing event model all play key rolls in how your large java application behaves. Given that you don't think java scales well, I doubt you are familiar with most of these techniques.

Intelligent code will always beat sloppy code, regardless of language.

That is, of course, very true. Personally, I'm much more into C++ programming (I find some of the "Sun knows best" features/exclusion of features in Java quite restrictive and annoying..).. So, for performance, I can only go by what I know of in terms of real world examples of significant applications.

This isn't exactly an apples-to-apples comparison (I don't even have any real hard data), so this might be questionable.. but I'll go ahead with it anyway. Let's compare a few pieces of software, written in Java vs. C++, and see the performance difference.

1) Star Office (older version of ~1-2 years ago - I don't know how well it performs now) vs. Microsoft Office
SO runs quite a bit slower than MS Office, in my experience.

2) Sun ONE Studio vs. Microsoft Visual Studio
Again, the Java program runs quite a bit slower (VERY noticable on my rather slow machine), and is more resource intensive.

This isn't really a persuasive argument, I'll admit.. but I can't go much farther without going into a lot more detail about language features, etc (of which I'm liable to make a few errors/omissions)..


Star Office isn't written in Java. So you're saying one C++ app is slower than another C++ app. Thanks for proving my point that intelligent code will win regardless of language.
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: Kilrsat
Star Office isn't written in Java. So you're saying one C++ app is slower than another C++ app. Thanks for proving my point that intelligent code will win regardless of language.

Hmm. I guess you're right on that one. I could have sworn SO was written in Java at some point in time, which was why Sun bought it.

I was never trying to say that well written, intelligent code will lose.. my point was, C/C++ gives more flexibility to the programmer to optimize their code than Java does.. and hence, well written, optimized C++ code will probably run faster than well written, optimized Java code.
 

manly

Lifer
Jan 25, 2000
13,286
4,060
136
Originally posted by: jediknight
Originally posted by: Kilrsat
Star Office isn't written in Java. So you're saying one C++ app is slower than another C++ app. Thanks for proving my point that intelligent code will win regardless of language.

Hmm. I guess you're right on that one. I could have sworn SO was written in Java at some point in time, which was why Sun bought it.

I was never trying to say that well written, intelligent code will lose.. my point was, C/C++ gives more flexibility to the programmer to optimize their code than Java does.. and hence, well written, optimized C++ code will probably run faster than well written, optimized Java code.
You're on a slippery slope when you make such blanket generalizations.

Also, if high-quality C++ code is only 10% faster than high quality Java code, what really is your point? Most people believe that writing high-quality, robust C++ code isn't easy to achieve.
 

imported_jediknight

Senior member
Jun 24, 2004
343
0
0
Originally posted by: manly
Also, if high-quality C++ code is only 10% faster than high quality Java code, what really is your point? Most people believe that writing high-quality, robust C++ code isn't easy to achieve.
I think we're talking about greater performance gains than just 10%, in certain areas. And yes, there is a tradeoff between robustness and efficiency of code.. but in C++ you have the choice, while in Java, oftentimes you do not. That doesn't mean you optimize the whole program, and to hell with robustness.. you profile, and optimize the 20% of the code that gets executed 80% of the time (the 80-20 rule).

As well, getting back to the topic of discussion at hand, then there's also the efficiency of the library code, and the ability for the graphics code to be hardware accelerated. I know if you do DX it can/will be.. but I'm not sure if that's the case if you're using the Java API for graphics (don't quote me on this one! )

Don't get me wrong, I like the Java programming language.. especially if what you're doing is cross platform It's just that I don't think it scales quite as well when you're dealing with very large projects. As well, feature wise, the lack of operator overloading and generic types annoy me at times..