Click here to Skip to main content
16,007,472 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: Why won't this work in Firefox or Netscape? Pin
Michael Sync21-Aug-07 21:47
Michael Sync21-Aug-07 21:47 
GeneralRe: Why won't this work in Firefox or Netscape? [modified] Pin
chaddolan22-Aug-07 0:54
chaddolan22-Aug-07 0:54 
GeneralRe: Why won't this work in Firefox or Netscape? Pin
Michael Sync22-Aug-07 3:07
Michael Sync22-Aug-07 3:07 
GeneralRe: Why won't this work in Firefox or Netscape? Pin
chaddolan22-Aug-07 7:07
chaddolan22-Aug-07 7:07 
GeneralRe: Why won't this work in Firefox or Netscape? Pin
Michael Sync22-Aug-07 7:46
Michael Sync22-Aug-07 7:46 
AnswerRe: Why won't this work in Firefox or Netscape? Pin
Guffa21-Aug-07 22:57
Guffa21-Aug-07 22:57 
GeneralRe: Why won't this work in Firefox or Netscape? Pin
chaddolan22-Aug-07 1:06
chaddolan22-Aug-07 1:06 
QuestionMouse hooking causing issues with WebBrowser dropdown control - Please Help! Pin
Sheeds21-Aug-07 16:07
Sheeds21-Aug-07 16:07 
Hoping someone can help me here, I'm uncertain if this is a VB problem or a problem with the WebBrowser control. I have a simple testharness and html page that the WebBrowser hosts.
When you run the test harness and press the ShowDlg button, the WebControl form (Form2) opens where you can happily choose values from the html dropdown in the WebBrowser using the mouse (or keyboard) - ok. However if you activate mouse hooking by pressing the Hook button first, when you then activate the WebControl form, you can no longer use the mouse to select options from the dropdown, you can open it and hover over options but if you select something with the mouse, the previous value is retained - the mouse hooking seems to interfere? Also, if the dropdown has vertical scrollbars, the mouse doesn't seem to work on that either? You can however select options from the dropdown using the keyboard.
Taking this a little further, the "Pass Msgs On" checkbox can be unchecked. This stops the call to CallNextHookEx (in Module1.bas) in the MouseProc which would mean as I understand it that the mouse messages this interrupts are no longer being passed on - however if you then goto the WebControl again, you'll see that we can now select options from the dropdown using the mouse? This to me would seem to work the opposite to how you'd logically think this would work - ie. swallowing the mouse messages you would think would cause the problems (if any), as you're not passing the messages on?
Any help/suggestions would be greatly appreciated! Hope I've explained this well enough - best use the code below to see the problem yourself.

Form1.frm:
<br />
VERSION 5.00<br />
Begin VB.Form Form1 <br />
   Caption         =   "MouseHook"<br />
   ClientHeight    =   1335<br />
   ClientLeft      =   60<br />
   ClientTop       =   450<br />
   ClientWidth     =   3015<br />
   LinkTopic       =   "Form1"<br />
   ScaleHeight     =   1335<br />
   ScaleWidth      =   3015<br />
   StartUpPosition =   3  'Windows Default<br />
   Begin VB.CheckBox Check1 <br />
      Caption         =   "Pass Msgs On"<br />
      Height          =   375<br />
      Left            =   120<br />
      TabIndex        =   3<br />
      Top             =   720<br />
      Width           =   1335<br />
   End<br />
   Begin VB.CommandButton Command3 <br />
      Caption         =   "ShowDlg"<br />
      Height          =   375<br />
      Left            =   1560<br />
      TabIndex        =   2<br />
      Top             =   720<br />
      Width           =   1335<br />
   End<br />
   Begin VB.CommandButton Command2 <br />
      Caption         =   "Unhook"<br />
      Height          =   375<br />
      Left            =   1560<br />
      TabIndex        =   1<br />
      Top             =   240<br />
      Width           =   1335<br />
   End<br />
   Begin VB.CommandButton Command1 <br />
      Caption         =   "Hook"<br />
      Height          =   375<br />
      Left            =   120<br />
      TabIndex        =   0<br />
      Top             =   240<br />
      Width           =   1335<br />
   End<br />
End<br />
Attribute VB_Name = "Form1"<br />
Attribute VB_GlobalNameSpace = False<br />
Attribute VB_Creatable = False<br />
Attribute VB_PredeclaredId = True<br />
Attribute VB_Exposed = False<br />
Private Sub Check1_Click()<br />
    If Check1.Value = vbChecked Then<br />
        Module1.bCallNextHook = True<br />
    Else<br />
        Module1.bCallNextHook = False<br />
    End If<br />
End Sub<br />
<br />
Private Sub Command1_Click()<br />
    Module1.Hook<br />
    SetState<br />
End Sub<br />
<br />
Private Sub Command2_Click()<br />
    Module1.Unhook<br />
    SetState<br />
End Sub<br />
<br />
Private Sub Command3_Click()<br />
    Dim frm As New Form2<br />
    frm.Show vbModal<br />
End Sub<br />
<br />
Private Sub Form_Initialize()<br />
    Module1.IsHooked = False<br />
    Check1.Value = vbChecked<br />
End Sub<br />
<br />
Private Sub Form_Load()<br />
    SetState<br />
End Sub<br />
<br />
Private Sub Form_Terminate()<br />
    Module1.Unhook<br />
End Sub<br />
<br />
Private Sub SetState()<br />
    Command1.Enabled = Not Module1.IsHooked<br />
    Command2.Enabled = Module1.IsHooked<br />
End Sub<br />

Form2.frm:
<br />
VERSION 5.00<br />
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"<br />
Begin VB.Form Form2 <br />
   Caption         =   "WebControl"<br />
   ClientHeight    =   1425<br />
   ClientLeft      =   60<br />
   ClientTop       =   450<br />
   ClientWidth     =   3570<br />
   LinkTopic       =   "Form2"<br />
   ScaleHeight     =   1425<br />
   ScaleWidth      =   3570<br />
   StartUpPosition =   3  'Windows Default<br />
   Begin SHDocVwCtl.WebBrowser WebBrowser1 <br />
      Height          =   3135<br />
      Left            =   0<br />
      TabIndex        =   0<br />
      Top             =   0<br />
      Width           =   4695<br />
      ExtentX         =   8281<br />
      ExtentY         =   5530<br />
      ViewMode        =   0<br />
      Offline         =   0<br />
      Silent          =   0<br />
      RegisterAsBrowser=   0<br />
      RegisterAsDropTarget=   1<br />
      AutoArrange     =   0   'False<br />
      NoClientEdge    =   0   'False<br />
      AlignLeft       =   0   'False<br />
      NoWebView       =   0   'False<br />
      HideFileNames   =   0   'False<br />
      SingleClick     =   0   'False<br />
      SingleSelection =   0   'False<br />
      NoFolders       =   0   'False<br />
      Transparent     =   0   'False<br />
      ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"<br />
      Location        =   ""<br />
   End<br />
End<br />
Attribute VB_Name = "Form2"<br />
Attribute VB_GlobalNameSpace = False<br />
Attribute VB_Creatable = False<br />
Attribute VB_PredeclaredId = True<br />
Attribute VB_Exposed = False<br />
Private Sub Form_Load()<br />
    WebBrowser1.Navigate "c:\mousehook\simpledropdown1.htm"<br />
End Sub<br />

Module1.bas
<br />
Attribute VB_Name = "Module1"<br />
Option Explicit<br />
<br />
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long<br />
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long<br />
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long<br />
<br />
Public Const WH_MOUSE = 7<br />
<br />
Public IsHooked As Boolean<br />
Public bCallNextHook As Boolean<br />
Global lpPrevMouseProc As Long<br />
<br />
Public Sub Hook()<br />
    If IsHooked Then<br />
        MsgBox "Don't hook it twice without " & "unhooking, or you will be unable to unhook it."<br />
    Else<br />
        lpPrevMouseProc = SetWindowsHookEx(WH_MOUSE, AddressOf Module1.MouseProc, 0, App.ThreadID)<br />
        IsHooked = True<br />
    End If<br />
End Sub<br />
<br />
Public Sub Unhook()<br />
    Dim temp As Long<br />
    If IsHooked Then<br />
        temp = UnhookWindowsHookEx(lpPrevMouseProc)<br />
        IsHooked = False<br />
    End If<br />
End Sub<br />
<br />
Function MouseProc(ByVal uCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long<br />
    Debug.Print "Message: " & uCode<br />
    If bCallNextHook Then<br />
        MouseProc = CallNextHookEx(lpPrevMouseProc, uCode, wParam, lParam)<br />
    End If<br />
End Function<br />

simpledropdown1.htm: (c:\mousehook\simpledropdown1.htm)
<br />
<HTML><br />
<HEAD><br />
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"><br />
</HEAD><br />
<BODY><br />
<P><br />
<SELECT id=select1 style="WIDTH: 147px"> <br />
  <OPTION selected></OPTION><br />
  <OPTION>1</OPTION><br />
  <OPTION>2</OPTION><br />
  <OPTION>3</OPTION><br />
  <OPTION>4</OPTION><br />
</SELECT><br />
</P><br />
</BODY><br />
</HTML><br />




-- modified at 23:58 Wednesday 22nd August, 2007
Questionload images without postback Pin
_crs_21-Aug-07 12:04
_crs_21-Aug-07 12:04 
AnswerRe: load images without postback Pin
Christian Graus21-Aug-07 12:43
protectorChristian Graus21-Aug-07 12:43 
GeneralRe: load images without postback Pin
_crs_21-Aug-07 14:29
_crs_21-Aug-07 14:29 
AnswerRe: load images without postback Pin
DavidNohejl23-Aug-07 5:35
DavidNohejl23-Aug-07 5:35 
QuestionHow to disable the screen while data exchange ??? Pin
devboycpp21-Aug-07 7:24
devboycpp21-Aug-07 7:24 
AnswerRe: How to disable the screen while data exchange ??? Pin
Michael Sync21-Aug-07 16:27
Michael Sync21-Aug-07 16:27 
QuestionResize the table in MSHTML Pin
SAKURAVN20-Aug-07 23:20
SAKURAVN20-Aug-07 23:20 
QuestionUser Roles Pin
Illegal Operation20-Aug-07 23:08
Illegal Operation20-Aug-07 23:08 
QuestionflvPlayer compatible with c#.net 2.0 Pin
harryforum20-Aug-07 20:46
harryforum20-Aug-07 20:46 
QuestionASP.NET TreeView-How to reduce the spacing between leaf nodes ? Pin
Andrew Qu20-Aug-07 12:03
Andrew Qu20-Aug-07 12:03 
QuestionWebService Authorization - The request failed with HTTP status 401: Unauthorized. Pin
BigBlueEye20-Aug-07 4:56
BigBlueEye20-Aug-07 4:56 
AnswerRe: Using javascript to read a SQL server database Pin
Michael Sync20-Aug-07 4:33
Michael Sync20-Aug-07 4:33 
QuestionReportViewer DLLs Pin
SharonaM20-Aug-07 3:59
SharonaM20-Aug-07 3:59 
Questionhow to create validate login form in javascript....? Pin
rambrahmam.g20-Aug-07 3:35
rambrahmam.g20-Aug-07 3:35 
AnswerRe: how to create validate login form in javascript....? Pin
Michael Sync20-Aug-07 4:30
Michael Sync20-Aug-07 4:30 
Questiondisable the save/copy images on right click of image in asp.net Pin
harryforum20-Aug-07 2:18
harryforum20-Aug-07 2:18 
AnswerRe: disable the save/copy images on right click of image in asp.net Pin
Michael Sync20-Aug-07 4:25
Michael Sync20-Aug-07 4:25 

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.