This code will actually open an other window but before that it will close the old window.
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
This code will only work if you're not changing the Caption of the form after it's loaded.
Good luck!