1

我刚开始使用 C++,我在网上搜索了创建单选菜单项的方法,但我很困惑。

最好的例子将有助于澄清事情。

所以,我希望能够像这样创建一个简单的单选菜单项:http: //i.imgur.com/7UrUtjS.png

但是,我坚持如何创建单选菜单项。到目前为止,我有这个:

    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....
4

1 回答 1

1

菜单项的“无线电”逻辑行为必须由您的代码提供。创建菜单项后,使用 ModifyMenu 将复选标记或位图添加/删除到相应的项。

于 2013-06-25T20:21:58.017 回答