Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 22016

Add item to context menu? Also, no menu select notification?

$
0
0
I can't seem to find any information about this. I don't see why it shouldn't be possible.

What I want to do is add an item to the right click menu of a textbox. I don't want to replace it with a menu of my own for various reasons.

This is the first thing I tried; not sure why it doesn't work.

I subclassed the textbox hwnd, and:

Code:

    Case WM_CONTEXTMENU
        Debug.Print "InsertText.Box.WM_CONTEXTMENU"
        hMenu = GetMenu(hWnd)
        Debug.Print "hMenu=" & CStr(hMenu)
        R = AppendMenu(hMenu, MF_SEPARATOR, 0, 0&)
        R = AppendMenu(hMenu, MF_STRING, idCtxClear, "Clear")
   
   
    Case WM_COMMAND
        Debug.Print "InsertText.Box.WM_COMMAND; loword(wparam)= " & LoWord(wParam)
    Case WM_MENUCOMMAND
        Debug.Print "InsertText.Box.WM_MENUCOMMAND; wparam= " & wParam

hMenu is non-zero, but AppendMenu returns 0 (failed).

Further down the road; WM_COMMAND and WM_MENUCOMMAND isn't firing for anything. I checked putting it in the WndProc for the main form, but it still didn't fire. (the WM_CONTEXTMENU does fire, so I have the right hWnd I think?)

Anyone can help with either of those issues??


Edit: Researching further, I dumped all messages trying to find out what was up; and while I got (for Cut) WM_MENUSELECT, WM_CUT, and WM_COPY, I didn't get anything about a menu option being selected. I'm confused.

Viewing all articles
Browse latest Browse all 22016

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>