Im writing a small application to take the job of IE as the primary Jpeg Viewer. My problem is i don't want it to open up a new program when i click on another picture how can i do that?
Printable View
Im writing a small application to take the job of IE as the primary Jpeg Viewer. My problem is i don't want it to open up a new program when i click on another picture how can i do that?
Are you using the Webbrowser Control? Because you can make it so that no other Window will open when the user right clicks and clicks on Open in New Window.
Code:Private Sub webbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
End Sub
no im using an imagebox.
This code will actually open an other window but before that it will close the old window.
This code will only work if you're not changing the Caption of the form after it's loaded.Code:Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const WM_CLOSE = &H10
Private Sub Form_Load()
Dim hWnd As Long
Dim sCaption As String
sCaption = Me.Caption
Me.Caption = ""
If App.PrevInstance = True Then
hWnd = FindWindow(vbNullString, sCaption)
SendMessage hWnd, WM_CLOSE, 0&, 0&
End If
Me.Caption = sCaption
'call whatever code you're using to load
'the picture here
End Sub
Good luck!