Advertisement

Why won't this menu work??

Started by July 25, 2000 03:20 PM
4 comments, last by ZedAgent 24 years, 5 months ago
I''ve been following Andre LaMothe''s book "Windows Game Programming for Dummies", and it has been GREAT at teaching me the basics. Every one of his examples have worked, and I have been able to incorporate all of his teachings into my own programs, except for one simple thing: menus. First I tried building a menu the old fashioned way, I made the resource script in a text editor and included a .h file that contained only 4 #define statements that defined the ID of the menu items. However, once I added the two files into my project and compiled, I got an "unexpected end of file" error generating from my .h file. Why would that happen?? The only thing in the file are 4 #define statements remember. I then tried to make the menu using VC++''s built in resource editor. I created the menu, made sure that I gave it an ID that I''d remember, and tried three different methods of loading and attaching the menu in the main source, none of which worked (setting winclass.lpszMenuName to my menu ID, using SetMenu(hwnd,LoadMenu(hinstance,"MENU1")). I''m sure I''m typing in the right ID for the menu, I also included resource.h, but no matter what I try the menu will not show up. I''m also getting no errors when I compile, and otherwise the program works exactly as it should. Any suggestions? This is really frustrating me
the "Unexpected end of file error" is one of two things
if you have a
#ifndef MY_H_FILE
#define MY_H_FILE

and then dont have
#endif

at the end of the file
where MY_H_FILE can be anything you want to name it

or if you have {
without a cooresponding }


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Advertisement
Instead of using SetMenu, just load set it in the WNDCLASS stuff. If you must use SetMenu, make sure you do not have to use the MAKEINTRESOURCE macro..

like this..

SetMenu(hwnd, MAKEINTRESOURCE(MENU_1));
tell us if it works

-Lucas
-dieraxx@programmer.net
-Lucas
Also, make sure your file ends with a "newline". I got a ueof because I forgot to hit enter one last time in one of the files. Ridiculous.
A polar bear is a rectangular bear after a coordinate transform.
Thank you very much everyone! Armitage, I think it was your suggestion that remedied the error. Thanks again! It''s good to see people so eager and quick to help
Doh, forgot to enter my username and password, just verifying that that post was by me

This topic is closed to new replies.

Advertisement