Thread: How do I make a Window Menu?

  1. #1
    Registered User
    Join Date
    Jan 2005
    Location
    Copenhagen, Denmark.
    Posts
    16

    Question How do I make a Window Menu?

    I've been searching a lot on google but can't seem to find a tutorial on making a menu to my window from scratch...would anyone pls tell me, or maybe someone had a link? Or a code where I could see how to do it?

  2. #2
    Registered User
    Join Date
    Nov 2004
    Location
    Slovenia, Europe
    Posts
    115
    Here's a good tutorial about Win32 programming...

    http://www.winprog.org/tutorial
    [C++]
    IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
    2nd compiler: g++ (GCC 3.4.3/4.0.0)
    3rd compiler: Borland 5.5
    [C#]
    IDE: Microsoft Visual C# Express 2005
    2nd IDE: SharpDevelop
    2nd compiler: csc in Command Prompt
    .NET Framework: 2.0
    [PHP]
    Core: 5.1.0 beta 3
    IDE: PHPEdit
    2nd IDE: Notepad
    Favourite extensions: exif,gd2,mysql
    Favourite PEAR packages: DB, XML_RSS, ID3
    Favourite databases: SQLite, MySQL

  3. #3
    Registered User
    Join Date
    Jan 2005
    Location
    Copenhagen, Denmark.
    Posts
    16
    Cool, thank you man!

  4. #4
    Registered User
    Join Date
    Jan 2005
    Location
    Copenhagen, Denmark.
    Posts
    16
    Hmm...I've been reading through the tutorial, and are now trying to make a dialog menu. I'm using the Dev-C++4 compiler, and when I make the following code inside the Resource Editor, it says there's a parse error in line two...
    Code:
    201 DIALOG 0, 0, 239, 66
    STYLE WS_VISIBLE | WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME
    CAPTION "My DialogMenu"
    FONT 8,"AboutFont"
    BEGIN
            DEFPUSHBUTTON "&OK",IDOK,174,18,50,14
            PUSHBUTTON "&Cancel",IDCANCEL,174,35,50,14
            GROUPBOX "About this program...",IDC_STATIC,7,7,225,52
            CTEXT "An example program\r\n\r\nby theForger",
                  IDC_STATIC,16,18,144,33
    END
    Well, I can't find it...is there something wrong with my compiler or...?

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    Slovenia, Europe
    Posts
    115
    You don't need to write resourcecode unless you really love to do it .You can use additional software - I preffer ResEd: http://radasm.visualassembler.com/projects/ResEd.zip (direct link).
    [C++]
    IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
    2nd compiler: g++ (GCC 3.4.3/4.0.0)
    3rd compiler: Borland 5.5
    [C#]
    IDE: Microsoft Visual C# Express 2005
    2nd IDE: SharpDevelop
    2nd compiler: csc in Command Prompt
    .NET Framework: 2.0
    [PHP]
    Core: 5.1.0 beta 3
    IDE: PHPEdit
    2nd IDE: Notepad
    Favourite extensions: exif,gd2,mysql
    Favourite PEAR packages: DB, XML_RSS, ID3
    Favourite databases: SQLite, MySQL

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Copenhagen, Denmark.
    Posts
    16
    Tha'ts a really cool resource editor - thx, but my compiler still tells me there's a ****ing parse error! Just that now its in line 7:
    Code:
    IDD_AboutDLG DIALOGEX 6,6,194,106
    CAPTION "About SS - Tactical Shield"
    FONT 8,"MS Sans Serif"
    STYLE 0x10CF0080
    EXSTYLE 0x00000001
    BEGIN
      CONTROL "About this game...",About SS - Tactical Shield,"Button",0x50000007,4,1,186,100,0x00000000
      CONTROL "",IDC_EDT1,"Edit",0x50010000,38,-6,0,0,0x00000200
      CONTROL "About Storm Strategy - Tactical Shield",IDC_STC1,"Static",0x50000000,40,24,120,9,0x00000000
      CONTROL "By Jacob Fishcer",IDC_STC2,"Static",0x50000000,62,44,76,8,0x00000000
      CONTROL "OK",IDC_BTN1,"Button",0x50010000,82,64,38,11,0x00000000
    END
    I really think it's my compiler that just sucks...or is there annother explanation?

  7. #7
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    I had the same problem, and i have the same ugly compiler...
    I figured it out somehow..But i cant remember how..

    I can just make guesses from my own recent RC scripts..

    try to include on the top
    #include <windows.h>
    #include <winresrc.h>


    Also remember to define your constants, but im sure you have allready done that.
    Like if you shall use IDC_EDT1 in your CONTROL statement, do something like this first, on the top of your RC script:
    Code:
    #define IDC_EDT1 392 //(Then, IDC_EDT1 corresponds to 392)
    Or you can simply write the integers you want to correspondent with the controlstatment, but things like IDC_EDT1 is easier to remember than pure integers.



    And on line 7, or the first CONTROL line, is the secound parameter not a constant. Try defining it as ONE word, just like the others..
    For example: "IDC_EDT1"..

  8. #8
    Registered User
    Join Date
    Jan 2005
    Location
    Copenhagen, Denmark.
    Posts
    16
    OK - I'll try that, hope it works; but I'm not gonna try it out now, as I've just run into some stupid "Illegal Action" problems with my code, so I'll script it all over again.
    Thx for the help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Window menu Probem
    By elwad in forum Windows Programming
    Replies: 5
    Last Post: 05-11-2009, 03:14 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  4. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  5. Winamp Vis if anyone can help
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-27-2002, 12:43 AM