01.03 - Comments and Suggestions

Started by
72 comments, last by Teej 20 years, 8 months ago
Dragon Shadow-X: WARNING: you won''t be able to use Win32 menus for full-screen DirectX games...

  1. Go to File|New and create a new resource script

  2. Right-click on the name of the script that appears in the main window, and select Insert Menu

  3. Double-click on the menu location you wish to edit. Popups open new menus, and therefore don''t have IDs. Name the popup File and you''ll see a new entry below it appear

  4. Double-click the new entry (below File) and enter an ID and caption (i.e. New...)

  5. Save your script file, and make sure that you include RESOURCE.H in your other project files (that use resources)


Depending on whether or not you use MFC, you''ll either process menu commands via your Window Procedure (Win32) or through a message map (MFC). Details on command messages for both can be found in the online help.

Is that what you were looking for?

Teej

Advertisement
Great Job!




Anonymous Programmer
Heard about your trouble with hosting, I would suggest trying freedom2surf, I''ve been using their free hosting for about a year, and their servers have always worked fine for me. Plus, you don''t get any annoying banners or popups on your site. Good luck.

------------------
It''s me again!
Thanks a lot Teej! Now I just need to know how to attach that menu to my window. [the ways the 2 books I have on it don''t work and I can''t seem to find it in the online help for VC++]

Direct X 7 in 24hrs:
window.lpszMenuNam = MAKEINTRESOURCE(IDR_MENU1);
I do this and no errors but I get a window with no menu.

Game Programming for Dummies[teaches DX 5 though]:
they say make menu in a text file and attach it like this:

CreateWindow(......,LoadMenu(hInstance, "MYMENU"),....);

Which I don''t understand either and doesn''t work even when I copy everything they did exactly!

Also a question about ID''s. When I tried to make "E&xit" they had several name id''s already there, IDCLOSE, got my attention. But then windows didn''t recognize it until I #defined it and gave it a number. If I want to make my own ID like ID_EXIT or something do I #define it in the resource header myself and then fill the name "ID_EXIT" in under "ID:" when I''m making a menu under the graphical interface?

P>S>Yeah I knew I wouldn''t be able to make a menu for a full screen dx application. I''m experimenting with windowed programs. Will you ever be covering those? I''d like to make a game that can run full screen or in a window on the desktop.
When I do menus they seem to work, what I do is name them as a string, with qoutes around the resource name and specify that in wc.lpszMenuName, but MAKEINTRESOURCE should work if you havent used quotes.
I think the answer to your problem is also the answer to your second problem, visual c++ does make defines for all the integer values (menu name, and all the commands) and it plonks them in a header file for you. Just add #include "resource.h" at the top, and it should work fine.
Well since no one[not the guy who posted after me or Teej] is responding to my e-mails I''ll post here:

Can anyone explain to me what he means by "what I do is name them as a string, with qoutes around the resource name and specify that in wc.lpszMenuName, but MAKEINTRESOURCE should work if you havent used quotes." How does one name their menu as a string/or use MAKEINTRESOURCE?

I''m a COMPLETE newbie when it comes to menus. Can ANYONE give me an example of how they name their menu and how to attach it to the window? I''m soooo close to making a windowed app but none of the resources I have is any help with menu''s!!

Any help will be SERIOUSLY appreciated!

Shadow Dragon-X
Sorry I didn''t reply sooner, I was away on holiday. I just read the sentance that I posted and it just confuses me too.

What you do to make a menu:
1) design it

2) in the resource view on the left name the resource "Menu" or something like that with the qoutes, or MENU.

3) add to the top of the file: #include "rosource.h" - this has all the constants for the menu name / selections etc.

4) when you are setting up your window class add:
wc.szMenuName = "Menu"
or
wc.szMenuName = MAKEINTRESOURCE(MENU)
depemnding on how you named it in step 2

5) in the message handler (WndProc) when you are interpreting the message (in the switch(msg) section) add:

case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_FILE_NEW: // the ID for the menu item
// add your code for this menu item here
break;
case default:
break;
}

I realise that I may have gone on a bit, but I thought that I might as well be complete to help other people in the forum
What happened to all the articles past 04.05?
I hope this tutorial isnt going
Shadow Dragon-X I dont know if you're still confused about menus but if you are, I highly recommend the tutorial on:

http://www.winprog.org/

It is simply the best tutorial on basic windows programming in C++,it will explain to you intirely about MAKEINTRESOURCE. It may not cover any Direct-X but I think it will clear up alot of confusion for you.

You can also try the tutorials on:

http://spiff.tripnet.se/~iczelion/

But all though they cover alot of details with standard windows programming, they are in assembaly language and could easilly confuse you further. *I only recommend you use this as a last choice alternative, if you are still stuck (Or know assembaly)*


Crash,


We Must Move Forwards NOT Backwards, Sideways NOT Forwards And Always Twirling Twirling Towards Success

Edited by - crash on August 26, 2001 7:31:10 AM
"We Must Move Forwards NOT Backwards, Sideways NOT Forwards And Always Twirling Twirling Towards Success." - 2000"If You Keep Looking Forward Your Gonna End Up Looking Backwards At Yourself Running Sideways!" - 2001
Great Job!

But I can''t find the second set(5+) of the tutorials... are they on this forum? A different page? Well I''ll keep looking, but I can''t find them anywhere.
Half the people you know are below average.Trogdor the Burninator

This topic is closed to new replies.

Advertisement