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
Printable View
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
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
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 ?
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
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