![]() ![]() Either SetWindowSubClass() or SetWindowLongPtr(GWL_WNDPROC) can be used, though the first is preferred. Subclass the edit control to intercept the WM_CONTEXTMENU message. I got the correct details from a PureBasic forum discussion. TecMan provided a link to a VBForums discussion that talks about it, however it gets a few details wrong. Update: there is a way to access and modify the edit control's standard popup menu after all (I just tested it and it worked). Which means you have to manually duplicate the functionality of any standard menu items that you want to appear in your custom menu. So the only option available is to subclass the edit control and handle the WM_CONTEXTMENU message instead, creating and displaying your own custom popup menu as needed. ![]() How do you do it? Alas, you have no choice but to reinvent the wheel In any case, suppose you want to add your own menu items to the edit control context menu. It's possible (and again I'm only guessing) that the authors were trying to improve performance by reducing message traffic. The edit control must be calling TrackPopupMenu with a null HWND handle and/or TPM_NONOTIFY, which tells the menu not to send notifications. edit controls don't send WM_INITMENUPOPUP. Q: Why isn't a WM_INITMENUPOPUP message generated when you right-click an edit control?Ī: I can't tell you why there isn't one, but I can confirm it's true. Unfortunately, a standard Win32 Edit control does not generate that message for its default popup menu, as confirmed in a November 2000 article of MSDN Magazine (the link on MSDN itself is dead, but this link is from the Internet Archive): Typically, when a control displays a popup menu, a WM_INITPOPUPMENU message is generated which " allows an application to modify the menu before it is displayed, without changing the entire menu."
0 Comments
Leave a Reply. |