   Creating a menu in a Window
  Hello, I've recently begun to learn how to create a window in C++. My current lesson is creating menus using this  tutorial . However when I write the code for the .rc file my compiler (Dev-C++) won't compile it (More accurately it starts compiling and never gets anywhere, the progress bar remains empty). I am not yet experienced enough in windows creation to properly debug this code, or even ascertain if it is the code or my compiler which is the issue, thus I throw myself at the mercy of you gamedev forumites.The offending code#include "resource.h"IDR_MYMENU MENU MBEGIN   POPUP "&File"    BEGIN   MENUITEM "E&xit", ID_FILE_EXIT    END    POPUP "&Stuff"    BEGIN   MENUITEM "&Go", ID_STUFF_GO   MENUITEM "G&o somewhere else", 0, GRAYED    ENDENDIDI_MYICON ICON "menu_one.ico"resource.h#define IDR_MYMENU 101#define IDI_MYICON 201#define ID_FILE_EXIT 9001#define ID_STUFF_GO 9002   
  EDIT: my bad, you did say you were using Dev-C++, which i think cannot compile resource files ( .rc ) so the below text is still somewhat valid, may i suggest that you do not use Dev-C++ as it is very outdated instead try visual C++ express if you are on a windows platform such as XP or vista, Code::Blocks for linux, or XCode ( I think ) for Mac.You need a compiler to build the .rc file, you never said what compiler your using, the only compilers i know that can compile .rc files are resource builder and visual studio professional/team suite editions ( ie. not express versions ) neither of which are free unfortunatly. If you have the express edition of visual C++ you wont be able to create resource files with it, instead find something that can compile them and include them with your project.   ;Quote:Original post by CodeCriminalYou need a compiler to build the .rc file, you never said what compiler your using, the only compilers i know that can compile .rc files are resource builder and visual studio professional/team suite editions ( ie. not express versions ) neither of which are free unfortunatly. If you have the express edition of visual C++ you wont be able to create resource files with it, instead find something that can compile them and include them with your project.Not correct. VS Express has the full resource compiler integrated into it. It just lacks the resource editor that the pay-for versions ship with.Right click on your "Resource Files" folder and "Add"->"New Item". Type "name.rc" or whatever to create your .rc file. I normally name this same as the application, not sure if that is required offhand.Now right click it and do "Open With". Select "Source Code (Text) Editor" and click "Set as Default". You can now double-click your rc file as normal to open it in the code editor.You can now create text-based rc files (as the OP has done) from within VS Express and they are automatically compiled and linked to your application.Obviously designing dialogs is a pain in text but for that there are third party editors (such as the mighty ResEdit) that produce rc files compatible with VS.Adam1942 - Dev-C++ is not a good choice of compiler compared to the free Visual Studio C++ Express which I would suggest you move to using. It can have a bit of a steep initial learning curve but people here will get you through the first few problems and they I promise you'll never look back. [smile](Oh, by the way, your code looks fine to me in your post so I suspect it is the compiler that is the problem).[Edited by - Aardvajk on May 5, 2009 2:30:03 PM];Quote:Original post by AardvajkRight click on your "Resource Files" folder and "Add"->"New Item". Type "name.rc" or whatever to create your .rc file. I normally name this same as the application, not sure if that is required offhand.Just wanted to clarify that the bolded quote isn't required.  To the OP, as stated, your code looks fine.   ;  I've downloaded visual express but now I have an issue, none of his code examples will compile! They all have errors converting from either LPCWSTR [] to LPCWSTR or from const char [] to LPCWSTR. Throughout the code these errors are poping up in function calls where the parameter expects LPCWSTR and he supplied one of the other two types. Any ideas on how I can fix this? I'm not really sure what a LPCWSTR is. I know its something like a constant pointer to a String, but I don't really know what the L or W stand for.   ;Quote:Original post by Adam1942I've downloaded visual express but now I have an issue, none of his code examples will compile! They all have errors converting from either LPCWSTR [] to LPCWSTR or from const char [] to LPCWSTR. Throughout the code these errors are poping up in function calls where the parameter expects LPCWSTR and he supplied one of the other two types. Any ideas on how I can fix this? I'm not really sure what a LPCWSTR is. I know its something like a constant pointer to a String, but I don't really know what the L or W stand for.Go into Project->Properties and in the Configuration Properties->General section, change Character Set to "Not Set".VS uses UNICODE by default but if you want to be able to compile most normal example code that is more than a year or so old, it's easiest to forget about UNICODE for now and just use normal ASCII.   ;  Thanks, that did it. Although for some reason a console also appears along with the window...On a side note, would you (you being everyone who isn't me :P) recommend purchacing a book on the win32 API? Would this be of any use to someone who can't properly create a window yet? Thus far I've read Beginning C++ Through Game Programing and Acclerated C++, I also have C++ Gotcha's but I have yet to finish that one. I was looking at  this but i'm not so sure that its what i'm looking for.   ;Quote:Original post by Adam1942Thanks, that did it. Although for some reason a console also appears along with the window...When you first create the project, you need to select Win32 Application instead of Console Application.For your existing project, go into Project Properties again, find the Linker section and go into System. Change SubSystem to Windows.Quote:Original post by Adam1942On a side note, would you (you being everyone who isn't me :P) recommend purchacing a book on the win32 API? Would this be on any use to someone who can't properly create a window yet? Thus far I've read Beginning C++ Through Game Programing and Acclerated C++, I also have C++ Gotcha's but I have yet to finish that one. I was looking at this /a> but i'm not so sure that its what i'm looking for.Books are always good unless money is tight.To be honest, a better question in these modern times would be to ask whether C++ and Win32 are the best tools to use for creating Windows applications. If you are talking about a basic framework window to get a Direct3D application up and running that's one thing, but using Win32 and C++ for anything involving Windows GUI is a real pain compared to, say, C# and the .NET libraries (or, indeed, C++ and one of the free GUI libraries such as wxWidgets).Having said that, I personally thoroughly enjoy Win32 programming but then I'm a bit decrepid in programmer terms and probably just set in my ways. Even with many years of Win32 programming experience, it still takes me absolutely ages to get even the most basic applications working. I consider Win32 GUI programming very much the luxury of a hobbyist and would almost never consider using it if I was being paid for my time.[EDIT] Looking at the TOC for the link you posted above, it doesn't look like Windows via C/C++ has much on Win32 GUI programming and would be a poor introduction. I'd go with SeymourClearly's suggestion below if I had to name a good introductory Win32 book, but I'd probably suggest you focus more on C++ books to get the language learned and use internet tutorials and the MSDN library for learning Win32.[Edited by - Aardvajk on May 5, 2009 5:07:52 PM];  The Charles Petzold Programming Windows book was the one I read (a long time ago) and it served me really well.  I've seen other people recommend that one here too.  It is a little old, but it's still very relevant.   ;  Oops double post (blush)   