|
-
May 7th, 2006, 01:47 PM
#1
Thread Starter
Addicted Member
WebBrowser1_NewWindow2 ??? Cancel = True
Hy, i have this part of code:
VB Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
End Sub
How do i change this option from a button? The NewWindow2 to be enabled. Thenx
Last edited by RoYeti; May 7th, 2006 at 01:58 PM.
-
May 7th, 2006, 02:13 PM
#2
Re: WebBrowser1_NewWindow2 ??? Cancel = True
If you mean controlling the appearing of a new window I guess this would work:
VB Code:
Private Sub cmd1_Click()
'0 = Not Blocking
'1 = Blocking
If cmd1.Tag = "0" Or cmd1.Tag = "" Then
cmd1.Caption = "Disable Blocking"
cmd1.Tag = "1"
Else
cmd1.Caption = "Enable Blocking"
cmd1.Tag = "0"
End If
End Sub
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
If cmd1.Tag = "0" Or cmd1.Tag = "" Then
Exit Function
Else
Cancel = True
End If
End Sub
-
May 7th, 2006, 02:29 PM
#3
Thread Starter
Addicted Member
Re: WebBrowser1_NewWindow2 ??? Cancel = True
hmm... I want to do like this :
VB Code:
Private Sub Form_Load()
timer1.interval=5000
timer1.enabled=true
End Sub
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
End Sub
Private Sub Timer1_Timer()
' here i want to enable the NewWindow2
timer1.enabled=false
End Sub
ideeas how to to that ?
-
May 7th, 2006, 07:34 PM
#4
Addicted Member
Re: WebBrowser1_NewWindow2 ??? Cancel = True
Put this API Function in your General Declarations:
VB Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Put this on your form:
VB Code:
Function Wait(seconds As Long) As Boolean
Dim tick As Long, tick2 As Long, Num As Long
Num& = seconds& * 1000
tick& = GetTickCount()
tick2& = GetTickCount()
Do Until tick2& - tick& >= Num&
tick2& = GetTickCount()
DoEvents
Loop
End Function
Ex:
VB Code:
Wait 5 'This will wait 5 seconds before loading new window
VB Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Wait 5
Debug.Print "Done, now loading New Window..."
End Sub
-
May 7th, 2006, 08:04 PM
#5
Re: WebBrowser1_NewWindow2 ??? Cancel = True
Do you want something like this ?
VB Code:
Option Explicit
Private bNoNewWindow As Boolean
'---------------------------------------------------------
Private Sub Command1_Click()
bNoNewWindow = Not bNoNewWindow
If bNoNewWindow Then
Command1.Caption = "Allow New Window"
Else
Command1.Caption = "Disable New Window"
End If
End Sub
'---------------------------------------------------------
Private Sub Form_Load()
Command1.Caption = "Disable New Window"
End Sub
'---------------------------------------------------------
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = bNoNewWindow
End Sub
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
|