PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 7, 2022

[FIXED] How do I create a Radio Menu Item in c++?

 November 07, 2022     c++, menu, menuitem, radio-button     No comments   

Issue

I just started C++ and I searched online for ways to create a radio menu item, but I'm quite confused.

Preferrable an example would help clear things up.

So, I want to be able to create a simple radio menu item like this: http://i.imgur.com/7UrUtjS.png

but, I'm stuck on how to create a radio menu item. So far I have this:

    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    int wmId, wmEvent;
    HRESULT hr;
    POINTER_INFO pointerInfo = {};

    HMENU hmenu = GetMenu(hWnd);
    HMENU hChangeMenu = CreateMenu();
    HMENU hGesture = CreateMenu();     
    HMENU hPointer = CreateMenu();       


    UNREFERENCED_PARAMETER(hr);

    if(changeAPI)
    {
        AppendMenu(hmenu, MF_POPUP, (UINT_PTR)hChangeMenu, L"API");


        **// I want this to be a radio menu item, all I know is the MF_POPUP**
        AppendMenu(hChangeMenu, MF_POPUP, (UINT_PTR)hGesture, L"Gesture");
        AppendMenu(hChangeMenu, MF_POPUP, (UINT_PTR)hPointer, L"Pointer"); 
        AppendMenu(hChangeMenu, MF_POPUP, (UINT_PTR)hTouch, L"Touch");


        changeAPI = false;

    }
    //....other stuff....

Solution

The "radio" logical behavior of the menu items must be provided by your code. After you have created the menu items use ModifyMenu to add/remove a check mark or bitmap to the appropriate items.



Answered By - ScottMcP-MVP
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing