|
-
Jul 26th, 1999, 01:35 AM
#4
Addicted Member
Sure. You will need to add a module (because subclassing can only be done in a standard module) and add this code:
Private Const (Add the mouseup constant here)
Private OldProc As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Const GWL_WNDPROC = (-4)
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Function WndProc(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wMsg
Case (Constant Name Here)
'Do your popup code here
WndProc=0
Exit Function
Case Else
'Pass on messages
WndProc = CallWindowProc(OldProc, wMsg, wParam, lParam)
End Function
Now in a form add:
Private Sub Form_Load()
OldProc=GetWindowLong(Webbrowser1.hWnd, GWL_WNDPROC)
SetWindowLong Webbrowser1.hWnd, GWL_WNDPROC, AddressOf WndProc)
End Sub
Private Sub Form_Unload()
'Important!
SetWindowLong Webbrowser1.hWnd, GWL_WNDPROC, OldProc
End Sub
For a better explanation, view my article at http://www.programmerz.com/vb/subcls/
Please could you send me that constant. Thanks.
[This message has been edited by vbsquare (edited 07-26-1999).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|