Checking stuff in a menu

This is a discussion on Checking stuff in a menu within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to to check an item (IE: by default a menu item is unchecked, but when someone clicks ...

  1. #1
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Checking stuff in a menu

    Is it possible to to check an item (IE: by default a menu item is unchecked, but when someone clicks it, it becomes checked)?

    I'm using MSVC++ 6.0 Enterprise if that helps.

    [EDIT]: Also using Win32, not MFC [/EDIT]
    Last edited by Quantrizi; 08-09-2003 at 03:40 PM.

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

    Question What API are you using?

    Are you using the Win32 API or MFC?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: What API are you using?

    Originally posted by SyntaxBubble
    Are you using the Win32 API or MFC?
    Win32 (Sorry, forgot to mention it).

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

    Lightbulb I think you are wanting this ...

    Code:
    // This Will Check A Menu Item
    // hMenu: handle of the menu
    // ID_MY_ITEM: id of menu item (ex. ID_FILE_NEW)
    // MF_CHECKED: self-explanatory :)
    
    CheckMenuItem(hMenu, ID_MY_ITEM, MF_CHECKED);
    Code:
    // This Will Check A Menu Item
    // hMenu: handle of the menu
    // ID_MY_ITEM: id of menu item (ex. ID_FILE_NEW)
    // MF_UNCHECKED: self-explanatory :)
    
    CheckMenuItem(hMenu, ID_MY_ITEM, MF_UNCHECKED);
    I hope this is what you wanted.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  5. #5
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: I think you are wanting this ...

    Originally posted by SyntaxBubble
    Code:
    // This Will Check A Menu Item
    // hMenu: handle of the menu
    // ID_MY_ITEM: id of menu item (ex. ID_FILE_NEW)
    // MF_CHECKED: self-explanatory :)
    
    CheckMenuItem(hMenu, ID_MY_ITEM, MF_CHECKED);
    Code:
    // This Will Check A Menu Item
    // hMenu: handle of the menu
    // ID_MY_ITEM: id of menu item (ex. ID_FILE_NEW)
    // MF_UNCHECKED: self-explanatory :)
    
    CheckMenuItem(hMenu, ID_MY_ITEM, MF_UNCHECKED);
    I hope this is what you wanted.
    Thanks, it does. Did you look at MSDN?

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

    Lightbulb Sure did.

    Yes, I sure did. But I don't use the Win32 API anymore. I use MFC with MSVC++ 6.0. I find it easy to use.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  7. #7
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: Sure did.

    Originally posted by SyntaxBubble
    Yes, I sure did. But I don't use the Win32 API anymore. I use MFC with MSVC++ 6.0. I find it easy to use.
    Any resources for MFC?

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

    Lightbulb Oh yes ...

    Yes, of course. When you go to the MSDN Library, http://msdn.microsoft.com/library/, there is a tree-view thing on the left. Click "Visual Tools and Languages", "Visual Studio 6.0", "Visual C and C++ 6.0", and then click "Product Documentation". That should be what you need. I basically taught myself most of MFC though.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  9. #9
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: Oh yes ...

    Originally posted by SyntaxBubble
    Yes, of course. When you go to the MSDN Library, http://msdn.microsoft.com/library/, there is a tree-view thing on the left. Click "Visual Tools and Languages", "Visual Studio 6.0", "Visual C and C++ 6.0", and then click "Product Documentation". That should be what you need. I basically taught myself most of MFC though.
    Thank you.

    Can you tell me in the FreeLibrary() function, is it that if it returns true that it worked, or if it returns false that it works?

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

    Post MSDN's explanation ...

    MSDN Library says that the function is successful if the return value is non-zero, which means 'true'. False is always a '0' (zero) value, and true is anything BUT '0' (zero). So FreeLibrary() is successful if it returns 'true'.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  11. #11
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: MSDN's explanation ...

    Originally posted by SyntaxBubble
    MSDN Library says that the function is successful if the return value is non-zero, which means 'true'. False is always a '0' (zero) value, and true is anything BUT '0' (zero). So FreeLibrary() is successful if it returns 'true'.
    Thank you BTW: The MFC thing on MSDN is pretty well dead (page not found).

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

    Lightbulb Another reference ...

    Well, if you have any good Peer-2-Peer applications, such as iMesh (i prefer this one ), WinMX, etc., then search "Visual C++" under documents.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

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

  13. #13
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    For the FreeLibrary() function, everytime I run it, it processes the result 3 times, then the program crashes. Got any idea on why this is? If you want, I can send you the file through AIM (evanescence s0ul).

  14. #14
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Microsoft's preffered MFC site is now http://www.codeguru.com, which also contains the MFC Programmers Sourcebook.

  15. #15
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by _Elixia_
    Microsoft's preffered MFC site is now http://www.codeguru.com, which also contains the MFC Programmers Sourcebook.
    Thank you. I'll check it out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a menu system
    By ICool in forum C Programming
    Replies: 9
    Last Post: 09-17-2007, 01:18 PM
  2. How to put a tick in a windows menu?
    By cloudy in forum Windows Programming
    Replies: 1
    Last Post: 07-08-2007, 06:02 PM
  3. Menu like file, edit, help, etc...
    By Livijn in forum Windows Programming
    Replies: 44
    Last Post: 01-23-2007, 05:49 PM
  4. Window menu question
    By axr0284 in forum Windows Programming
    Replies: 0
    Last Post: 03-08-2005, 09:01 AM
  5. quick question about C Dos text menu pgm i was doing
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 09-16-2001, 11:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21