Jump to content
  • Advertisement
Sign in to follow this  
guitarguy

window creation using windows api

This topic is 3740 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

im a beginner games programmer still, but i think im at the point where im a bit tired of writing stuff for console and want to get either directx or opengl initialised. and apparently i need to make a blank window using the windows api, for the best result. ive tried tons of tutorials on this, such as http://www.cprogramming.com/tutorial/opengl_first_windows_app.html if i use the code from this tutorial i get errors, such as: error C2371: 'WNDCLASS' : redefinition; different basic types error C2143: syntax error : missing ';' before '.' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C2371: 'window_class' : redefinition; different basic types 'LPCTSTR' : illegal use of this type as an expression and so on, repeated many times and the same errors from pretty much any other tutorial. i tried a project that came with my "teach yourself game programming with directx in 21 days" book, and visual studio did some kind of conversion and then it worked, so i think there might be a problem with my version of visual studio? so far it seems like nothing ive programmed yet. i understand the structure (to some extent) such as the way the functions are defined, the main loop, the process of setup, creation, registration, event handler, but it all just seems like a lot to remember, is it really necessary to remember all this? or can i get it working once and then not write it ever again? or does anyone know an easier approach to this ? cheers

Share this post


Link to post
Share on other sites
Advertisement
Just glancing over that tut and your errors you might have missed that it is WNDCLASSEX and not just WNDCLASS. This is located in two spots, once to define the window class object and once to define the size of the object (they're about 5 lines apart). If you post the code from that tutorial that you wrote which doesn't compile we could help you more.

Share this post


Link to post
Share on other sites
i commented out #include "stdafx.h" and the list of errors changed. i pasted the code and the errors in this pastebin

http://gamedev.pastebin.com/m265c04d7

Share this post


Link to post
Share on other sites
*Never* learn with tutorials (written by kids...)
Read the Petzold + the Richter, and you'll be able to do everything.

Share this post


Link to post
Share on other sites
Quote:
Original post by guitarguy
i commented out #include "stdafx.h" and the list of errors changed. i pasted the code and the errors in this pastebin

http://gamedev.pastebin.com/m265c04d7


Why do you mix Unicode and non-Unicode ?!

Share this post


Link to post
Share on other sites
Quote:
Original post by george135
*Never* learn with tutorials (written by kids...)
Read the Petzold + the Richter, and you'll be able to do everything.


Thanks for the recommendation, guy

it might be a few days before i can get hold of a book, unless there is some online version of it. i didnt write the tutorial, but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated.im using visual studio 2005 v8.0.

cheers

Share this post


Link to post
Share on other sites
I didn't want to say this before because I was hoping that changing WNDCLASSEX would fix it, but I would seriously consider a different tutorial. I've built a couple simple graphical demos with DirectX and haven't seen many of the lines you've got there. Not to say they're not useful and don't work, but it seems quite unconventional, at least to me.

Try the window tutorial at C-Unit and see if that works. If not theres probably something wrong with your includes but from the errors you mentioned I think it's more of a fact that the tutorial might be outdated.

Quote:
*Never* learn with tutorials (written by kids...)


Only if the tutorials suck, which they usually do.

Talk to programmers and learn when to distinguish a good tutorial from a bad one (based on certain lines). Do NOT copy and paste and hit build/run, you will not learn anything and it probably will not work (not that you are, just as a general guideline). When I get home I'll see if I can compile a simple window program for ya if I remember.

Share this post


Link to post
Share on other sites
Quote:
but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated


I will be very impressed indeed if someone can do that, seeing as this is C.

Share this post


Link to post
Share on other sites
Quote:
Original post by Portmanteau
Quote:
but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated


I will be very impressed indeed if someone can do that, seeing as this is C.


Game...set...match. Wow, I can't believe I didn't notice that earlier. Man, I just got slapped with a noob stick. Granted I knew it wasn't VB at least.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!