Home > Software engineering >  Ask: "Thunk subclassing" text box control, how to block the right-click menu (i.e., shield
Ask: "Thunk subclassing" text box control, how to block the right-click menu (i.e., shield

Time:03-17

UniText controls, has the full source code, but the right-click menu I always can't block, from the download url:
https://www.vbforums.com/showthread.php? 500026 - VB6 - UniControls - Summer - Release - 2008-06-19

(another: beauty diagram at the bottom of the post, preserved the UniText control complete source code, please right click on the pictures, choose "save picture as... "; Will download good image files, change a extensions, such as: PIC. Zip, can extract,)

This text box control, can support Unicode characters in VB6 display and editing, it seems to be some bugs, I repeatedly checked several times the source code, temporarily also could not find the reason, now going to take it as "a read-only board", however, don't want to set the Enabled false, just want to have Locked all editing and shield the right-click menu,

Shielding right-click menu online code, mostly in the form of "subclass", and then use SetWindowLongA Settings window message processing function, with shielding WM_CONTEXTMENU messages,
Now this UniText control more "high end", the feeling is Thunk technology is used to implement "subclass" VB6 controls,

I add around in the source code:
Ssc_AddMsg WM_CONTEXTMENU
If (uMsg=WM_CONTEXTMENU) Then the Exit Sub
It is no use like,
Thunk in their own unique way of "black box", internal maintains a "callback" list, but I always feel not through internal details,

Masters, you don't know whether there is a good way?

Or, whether there is such a possibility:

To control as long as a received WM_CONTEXTMENU messages, from the Windows of the message list, directly delete this message, and automatically jump to the next message? (that is, the violence to delete all the unwanted messages, as they have never been to the world, ha ha,)


CodePudding user response:

Repeatedly reading UniText CTL source, in line 2060, can be found to replace the new message handler code:
Z_Sc (IDX_PREVPROC)=SetWindowLongW (lng_hWnd GWL_WNDPROC, z_ScMem + WNDPROC_OFF) 'Set the new WndProc, return the address of the the original WndProc
Reveals that the address is: new message handler z_ScMem + WNDPROC_OFF
And the address of the old message processing function is: z_Sc (IDX_PREVPROC)
But I really don't understand, the new message handler is to which a specific function name?
I'm going to bring shielding WM_CONTEXTMENU messages code, and should add in where?
Please pass by friends, point slightly pull the silly me,
Maybe, you a word can be god wants us to meet a few wrong people wake up! - thank you! Thank you very much!
  • Related