Click here to Skip to main content
15,902,797 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: Turning on a program Pin
tronix011-Dec-08 9:22
tronix011-Dec-08 9:22 
GeneralRe: Turning on a program Pin
byval1-Dec-08 19:31
byval1-Dec-08 19:31 
QuestionExtract .CAB file Pin
~Khatri Mitesh~24-Oct-08 22:57
~Khatri Mitesh~24-Oct-08 22:57 
AnswerRe: Extract .CAB file Pin
Joel Ivory Johnson4-Nov-08 18:58
professionalJoel Ivory Johnson4-Nov-08 18:58 
GeneralRe: Extract .CAB file Pin
~Khatri Mitesh~4-Nov-08 22:00
~Khatri Mitesh~4-Nov-08 22:00 
Questionwrite a simple mobile application Pin
Member 264536524-Oct-08 0:12
Member 264536524-Oct-08 0:12 
AnswerRe: write a simple mobile application Pin
lincyang6-Nov-08 17:33
lincyang6-Nov-08 17:33 
QuestionDisable Context Menu in Webbrowser control Pin
rlm094322-Oct-08 7:54
rlm094322-Oct-08 7:54 
Hi all,

I have code in WM6.1 and cf 2.5 (I believe) that overrides the WndProc to intercept messages going to a web browser control with the intent of disabling the context menu. I am successfully intercepting the messages and preventing the context menu from showing. However, as soon as I navigate off the form back to the previous one, that form will be frozen for a few seconds and then I get a GWES.exe error - usually a couple of them. The interesting thing is that I get that error if I click the web browser in any manner. E.g. I can just click a link or click in the middle of some text - not a tap-and-hold - and still the gwes.exe error, but if I don't click the control anywhere, just scroll for instance, no error occurs. Below is some code snippets:

Private Const WM_CONTEXTMENU = &H7B     'message to intercept to suppress context menu
Private wbHWnd As IntPtr    'Hold the pointer of the window to subclass
Private GWL_WNDPROC As IntPtr = New IntPtr((-4))    'Parameter for setwindowlong
Private prevHandle As IntPtr    'Original handle of window to subclass
Private myCallback As New SubclassCallback(AddressOf Me.SubclassCallbackHandler)


' Prototype delegate to handle callbacks from subclassed control
    Private Delegate Function SubclassCallback(ByVal hWnd As IntPtr, ByVal Msg As IntPtr, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

' Subclasses a control with a callback
Private Declare Function SetWindowLong Lib "coredll" (ByVal hWnd As IntPtr, ByVal nIndex As Int32, ByVal dwNewLong As SubclassCallback) As IntPtr

Private Declare Function GetWindowLong Lib "coredll" (ByVal hWnd As IntPtr, ByVal nIndex As Int32) As IntPtr

' Unsubclasses a control
Private Declare Function SetWindowLong Lib "coredll" (ByVal hWnd As IntPtr, ByVal nIndex As Long, ByVal dwNewLong As IntPtr) As IntPtr

' Forwards a message to a subclassed control
Private Declare Function CallWindowProc Lib "coredll" (ByVal lpPrevWndFunc As IntPtr, ByVal hWnd As IntPtr, ByVal Msg As IntPtr, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

'** This is in the form load

'Get the handle to the appropriate window to suppress the context menu
Dim ptrChildWindows() As IntPtr = GetWindows(Me.wbMessage.Handle)
Dim ptrChildWindows2() As IntPtr = GetWindows(ptrChildWindows(0))

'Used CE Spy to determine which window received the context menu messages
Me.wbHWnd = ptrChildWindows2(1)
        
' Subclass the window that receives the messages needed to suppress the context menu        
Me.prevHandle = SetWindowLong(Me.wbHWnd, GWL_WNDPROC, Me.myCallback)

' Handles all the messages sent to original handle
    Private Function SubclassCallbackHandler(ByVal hWnd As IntPtr, ByVal Msg As IntPtr, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

        ' Process whatever messages you want here
        Select Case Msg
            Case WM_CONTEXTMENU
                '    'Don't process
                Return 1
            Case Else
                ' NOTE : THIS IS VERY IMPORTANT ! FORWARD MESSAGE TO ORIGINAL HANDLE
                Return CallWindowProc(Me.prevHandle, hWnd, Msg, wParam, lParam)
        End Select

    End Function

Private Sub frmHTMLMessage_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

        ' Unsubclass control (use overloaded version)
        SetWindowLong(Me.wbHWnd, GWL_WNDPROC, Me.prevHandle)

    End Sub


Cheers,
Rob
AnswerRe: Disable Context Menu in Webbrowser control Pin
rlm09433-Nov-08 11:29
rlm09433-Nov-08 11:29 
Question.Net Application Deploy on Linux PDA Pin
manish.singhal22-Oct-08 1:10
manish.singhal22-Oct-08 1:10 
AnswerRe: .Net Application Deploy on Linux PDA Pin
Joel Ivory Johnson4-Nov-08 18:55
professionalJoel Ivory Johnson4-Nov-08 18:55 
QuestionNeed Suggestion Pin
wasimsharp21-Oct-08 23:23
wasimsharp21-Oct-08 23:23 
AnswerRe: Need Suggestion Pin
PavanPareta22-Oct-08 18:27
PavanPareta22-Oct-08 18:27 
GeneralRe: Need Suggestion Pin
wasimsharp22-Oct-08 19:03
wasimsharp22-Oct-08 19:03 
QuestionHow i can create the Iphone application Pin
wasimsharp20-Oct-08 20:09
wasimsharp20-Oct-08 20:09 
AnswerRe: How i can create the Iphone application Pin
Rupesh Kumar Swami20-Oct-08 20:38
Rupesh Kumar Swami20-Oct-08 20:38 
GeneralRe: How i can create the Iphone application Pin
wasimsharp20-Oct-08 20:59
wasimsharp20-Oct-08 20:59 
GeneralRe: How i can create the Iphone application Pin
Joel Ivory Johnson4-Nov-08 18:53
professionalJoel Ivory Johnson4-Nov-08 18:53 
AnswerRe: How i can create the Iphone application Pin
Zippy Pack7-Dec-08 8:13
Zippy Pack7-Dec-08 8:13 
Questionhow to spy the event when the user remove the SD card? Pin
lichongbin20-Oct-08 3:02
lichongbin20-Oct-08 3:02 
AnswerRe: how to spy the event when the user remove the SD card? Pin
Joel Ivory Johnson4-Nov-08 19:17
professionalJoel Ivory Johnson4-Nov-08 19:17 
QuestionUninstall/Remove application on windows mobile 5 Pin
Starzfighter19-Oct-08 22:57
Starzfighter19-Oct-08 22:57 
Questionnewb to mobile web development Pin
airwalk33118-Oct-08 22:01
airwalk33118-Oct-08 22:01 
AnswerRe: newb to mobile web development Pin
airwalk33119-Oct-08 16:34
airwalk33119-Oct-08 16:34 
AnswerRe: newb to mobile web development Pin
Joel Ivory Johnson6-Nov-08 14:44
professionalJoel Ivory Johnson6-Nov-08 14:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.