• Advertisement

Archived

This topic is now archived and is closed to further replies.

need Windows/C++ gurus help

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

I am writing a new windows class for a new game I am going to work on. I have a dialogue box to ask the user what resolution to run in. The problem is I have been unsure of my design. I have globals in the file WinMain when I dont want to really use them ,I have tried fiddling around i.e making member functions static(so defeating the object ). Could you please look at my code and suggest on a better implementation for this part of the class. Ps I am quite new to making more complex windows applications. my code can be downloaded from http://members.lycos.co.uk/knealeaj/files/ Thanks

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the reply .But I want to finish this class as it is nearly complete. And I like to know the solution for my own interest

Share this post


Link to post
Share on other sites
Well the first thing that I noticed about your code is that the wrap of the windows class is incomplete. You create the window with the class funtion and then you use a non-class window procedure... the way I reccomend that you do it is to make the wnd proc a static member of the class and have it route messages to each of the class''s instances. You can retrieve the message''s window by using the function GetWindowLong() with GWL_USERDATA.

I believe that there is a tutorial here about writing a windows message wrapper... found it. I hope this will be helpfull:

http://www.gamedev.net/reference/articles/article1810.asp

Share this post


Link to post
Share on other sites
Thanks I made the WndProc a static member but how do I deal with the ScreenDlgProc.

Share this post


Link to post
Share on other sites
As far as the Dlg Proc is concerned... if you only use the Dlg once then leaving it where it is now is fine. If you plan to use it more than once or if you are going to include it into another file... then you will probably want to write a class with a similar static member as the window.

Share this post


Link to post
Share on other sites

  • Advertisement