Thread: Menu 's??????

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    Menu 's??????

    Hello I've just been messing around (and I'm also new to windows) but can I plz get some help onhow to make them Menu 's at the top of the window like "File" or "Edit" or whatever plz dont tell me to go to the faq or point me to some useless site can somebody plz explain how this is done


    cheers


    stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Well, first..

    You have to add controls AFTER you create a menu. To create a File -> Exit menu, the right above case WM_DESTROY:

    type:

    HMENU hMenu, hSubMenu

    above switch(message)

    case WM_CREATE: //Place above case WM_DESTROY:

    #define CM_FILE_EXIT 10

    hMenu = CreateMenu();

    hSubMenu = CreatePopupMenu();
    AppendMenu(hSubMenu, MF_STRING, CM_FILE_EXIT, "&Exit");
    AppendMenu(hSubMenu, MF_STRING + MF_POPUP, (UINT)hSubMenu, "&File");

    SetMenu(hwnd, hMenu);

    break;
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    ok thanks for the help man I'll try that out


    cheers


    stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    damn I thought that I would just copy and paste in then I would look at it and see what it does but I cant figure it out so if it's ok mate and if it's not too much trouble do u think u could let me know what the most of it does


    cheers


    stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  5. #5
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    Stealth was IDE are you using, cause if your using Visual C++ then just add a resource script, and use their resource dev tool to make a menu. If your using Bloodshed then make a resource script and add this code

    IDC_DCX MENU DISCARDABLE
    BEGIN
    POPUP "&File"
    BEGIN
    MENUITEM "E&xit", IDM_EXIT
    END
    END
    then add wcex.lpszMenuName = (LPCSTR)IDC_DCX; where you register your class name.

    thats the easy way
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    wow man that looks pretty easy and is kinda easier to understand hmm at last I'm gettin gsoewhere oh well time to try it out and see what I get thanks alot mate oh yeah I'm not rich so I'm using DevC++


    cheers

    stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    hmm mno sorry about this really but I still dont get it I think I need to start from the very begginning see Dev have their own little something that lets u make a window just by clicking some blimmin thing but I dont like that I would like to learn on my own how to do that and then add the menu ,well it seems like Dev gets me into bad habits so I think I should just set up this bordland if I can find it and use that I think that would be better
    anyway if u can help out man thanks


    cheers


    stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  8. #8
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    Hey Stealth;

    yeah sorry man i find that my ppl skills arnt very good, and i have a hard time explaining things. I forgot to tell you you will need to create a resource.h file and #define your menu items in that.

    anyways i created a blank window for you with just a menu. i uploaded the .zip file to my site, go download that, it should be simple to understand, but please ask if you have trouble. its a vc++ project file so youll have to open the .cpp and .rc through your IDE. cya.

    oh damm the link is, http://www.praxis1.vic.edu.au/home/dcola/teeeee.zip
    i see you on the board now, so give it about 2 mins before you go there cause its still uplaoding.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  9. #9
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    ok thanks man ur a life saver I'll check this out cheers mate thanks alot
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  10. #10
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Try this theForger's Win32 API Programming Tutorial and learn how to do it from scratch!

    p.s. Print it out so you can look at paper. I think that it helps.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    ok thanks to u too buddy
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  12. #12
    Unregistered
    Guest
    Don't forget DrawMenuBar() after you have changed the menu or you will not see the changes.

    PS I don't like SyntaxBubbles code (it may work though). He is adding items to a submenu that is yet to be added to the main one. Also AppendMenu() is old/not supported function. Use InsertMenuItem().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM