Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to disable pop-up menu on IE browser control or flash control
#3
A function like PreTranslateMessage can be created in two ways:
1. Use modeless dialog with message loop. It intercepts messages posted to the dialog and to its controls.
2. Use SetWindowsHookEx(WH_GETMESSAGE). It intercepts messages posted to any window or control of current thread.

Both intercept only posted messages, not sent messages. And it is rarely useful.

Usually need to intercept messages posted or sent to some 1 or several controls. Then subclass the controls.

In this case subclassing is not so easy as usually, because:
1. ActiveX controls usually have a child control. Need to find it (use child(...)).
2. Web browser's child control may be still not created when received WM_INITDIALOG. In this example I use timer as a workaround.

The #sub WndProc_Subclass can be created using template: menu -> File -> New -> Templates -> WndProc -> WndProc_Subclass.

Macro Macro3043
Code:
Copy      Help
typelib ShockwaveFlashObjects {D27CDB6B-AE6D-11CF-96B8-444553540000} 1.0

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 544 266 "Dialog"
;3 ActiveX 0x54030000 0x0 8 8 256 216 "ShockwaveFlashObjects.ShockwaveFlash {D27CDB6E-AE6D-11CF-96B8-444553540000}"
;4 ActiveX 0x54030000 0x0 280 8 256 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;1 Button 0x54030001 0x4 408 240 48 14 "OK"
;2 Button 0x54030000 0x4 476 240 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "4"
str ax4SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetWindowSubclass(child("" "MacromediaFlashPlayerActiveX" id(3 hDlg)) &sub.WndProc_Subclass 1 0)
,SetTimer hDlg 1 100 0
,
,SHDocVw.WebBrowser we4
,we4._getcontrol(id(4 hDlg))
,we4.Navigate("www.quickmacros.com")
,
,case WM_TIMER
,sel wParam
,,case 1
,,int wies=child("" "Internet Explorer_Server" id(4 hDlg)); if(wies=0) ret
,,SetWindowSubclass(wies &sub.WndProc_Subclass 2 0)
,,KillTimer hDlg wParam
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


#sub WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData

;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_RBUTTONDOWN
,out "Right Menu!"
,ret

int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass)
,
,;case ...

ret R


Messages In This Thread
RE: How to disable pop-up menu on IE browser control or flash control - by Gintaras - 04-23-2018, 05:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)