her er koden:
'-----form1----------
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
Dim ret As Long
ret = ShellExecute(Me.hwnd, "Open", "
http://www.harleyguiden.dk", "", App.Path, 1)
End Sub
'-----------form1----------
'-----------modul----------
Option Explicit
Private Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function IsWindowVisible& Lib "user32" (ByVal hwnd As Long)
Private Declare Function GetParent& Lib "user32" (ByVal hwnd As Long)
Dim sPattern As String, hFind As Long
Private Function FindActivateTitle(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim k As Long, sName As String
If IsWindowVisible(hwnd) And GetParent(hwnd) = 0 Then
sName = Space$(128)
k = GetWindowText(hwnd, sName, 128)
If k > 0 Then
sName = Left$(sName, k)
If lParam = 0 Then sName = UCase(sName)
If sName Like sPattern Then
hFind = hwnd
FindActivateTitle = 0
Exit Function
End If
End If
End If
FindActivateTitle = 1
End Function
Function ActivateAppHwnd(sTitle As String, Optional sMatchCase As Boolean = True) As Long
sPattern = sTitle: hFind = 0
If Not sMatchCase Then sPattern = UCase(sPattern)
EnumWindows AddressOf FindActivateTitle, sMatchCase
ActivateAppHwnd = hFind
End Function
'------modul------------