|
 |
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
 |
กระทู้ #1984 [Vb] (จาก IP: 124.121.194.37)
ไครก็ได้ช่วยสอน Code VB สั่งเปิด Internet Explorer ไปหน้าที่เรากำหนดไว้ได้ม่ะ
ไครก็ได้ช่วยสอน Code VB สั่งเปิด Internet Explorer ไปหน้าที่เรากำหนดไว้ได้ม่ะ
สอนที่ครับผม เด็กอายุ15ปีหัดเขียนอ่าครับ
Email llnjllsjllsj_nutza@hotmail.com
ช่วยสอนเด็กตาดำๆหน่อยน้าครับ หัดเขียน อิอิ
|
จากคุณ
:
นัท / llnjllsjllsj_nutza@hotmail.com [2008-04-29 21:33:35]
|
|
ความคิดเห็น #26710 (จาก IP: 58.8.202.20)
Dim objIE As Object Set objIE = CreateObject("InternetExplorer.Application") With objIE .Navigate "http://www.windowsupdate.com" .Visible = True End With Set objIE = Nothing |
จากคุณ
:
sup98 [2008-04-30 08:56:10]
|
 |
ความคิดเห็น #26711 (จาก IP: 58.8.202.20)
ShellExecute GetDesktopWindow(), vbNullString, "http://www.windowsupdate.com", vbNullString, vbNullString, SW_SHOWNORMAL |
จากคุณ
:
sup98 [2008-04-30 08:57:11]
|
 |
ความคิดเห็น #26712 (จาก IP: 58.8.202.20)
Option Explicit
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 Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public Function LaunchInNewwindow(sURL As String) As Boolean Const SW_SHOWNORMAL = 1 Dim lRetVal As Long Dim sTemp As String Dim sBrowserExec As String sBrowserExec = GetBrowserExe 'get the exe sURL = AddHTTP(sURL)
lRetVal = ShellExecute(GetDesktopWindow(), "open", sBrowserExec, sURL, sTemp, SW_SHOWNORMAL) ' lRetVal = ShellExecute(frm.hWnd, "open", sURL, "", sTemp, SW_SHOWNORMAL) '1998/07/31 This works as well If lRetVal > 32 Then ' OK LaunchInNewwindow = True End If End Function
Private Function AddHTTP(sURL As String) As String ' 2004/12/16 Function added by Larry Rebich using the DELL8500 while in Fort McDowell, AZ ' 2004/12/16 Add http:// is none Dim sTemp As String sTemp = sURL If InStr(LCase$(sTemp), "https://") = 1 Then AddHTTP = sTemp ElseIf InStr(LCase$(sTemp), "http://") = 1 Then AddHTTP = sTemp Else AddHTTP = "http://" & sTemp End If
End Function
Public Function GetBrowserExe() As String Dim sFilename As String Dim sBrowserExec As String * 255 Dim lRetVal As Long Dim iFN As Integer Dim sTemp As String sBrowserExec = Space(255) sFilename = App.Path & "\temphtm.HTM" iFN = FreeFile() ' Get unused file number Open sFilename For Output As #iFN ' Create temp HTML file Print #iFN, "<HTML> <\HTML>" ' Output text Close #iFN ' Close file ' Then find the application associated with it. lRetVal = FindExecutable(sFilename, sTemp, sBrowserExec) ' If an application return the name If lRetVal <= 32 Or IsEmpty(sBrowserExec) Then ' Error Else GetBrowserExe = Trim$(sBrowserExec) End If Kill sFilename ' delete temp HTML file
End FunctionOption Explicit
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 Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public Function LaunchInNewwindow(sURL As String) As Boolean Const SW_SHOWNORMAL = 1 Dim lRetVal As Long Dim sTemp As String Dim sBrowserExec As String sBrowserExec = GetBrowserExe 'get the exe sURL = AddHTTP(sURL)
lRetVal = ShellExecute(GetDesktopWindow(), "open", sBrowserExec, sURL, sTemp, SW_SHOWNORMAL) ' lRetVal = ShellExecute(frm.hWnd, "open", sURL, "", sTemp, SW_SHOWNORMAL) '1998/07/31 This works as well If lRetVal > 32 Then ' OK LaunchInNewwindow = True End If End Function
Private Function AddHTTP(sURL As String) As String ' 2004/12/16 Function added by Larry Rebich using the DELL8500 while in Fort McDowell, AZ ' 2004/12/16 Add http:// is none Dim sTemp As String sTemp = sURL If InStr(LCase$(sTemp), "https://") = 1 Then AddHTTP = sTemp ElseIf InStr(LCase$(sTemp), "http://") = 1 Then AddHTTP = sTemp Else AddHTTP = "http://" & sTemp End If
End Function
Public Function GetBrowserExe() As String Dim sFilename As String Dim sBrowserExec As String * 255 Dim lRetVal As Long Dim iFN As Integer Dim sTemp As String sBrowserExec = Space(255) sFilename = App.Path & "\temphtm.HTM" iFN = FreeFile() ' Get unused file number Open sFilename For Output As #iFN ' Create temp HTML file Print #iFN, "<HTML> <\HTML>" ' Output text Close #iFN ' Close file ' Then find the application associated with it. lRetVal = FindExecutable(sFilename, sTemp, sBrowserExec) ' If an application return the name If lRetVal <= 32 Or IsEmpty(sBrowserExec) Then ' Error Else GetBrowserExe = Trim$(sBrowserExec) End If Kill sFilename ' delete temp HTML file
End Function |
จากคุณ
:
sup98 [2008-04-30 08:57:56]
|
 |
ความคิดเห็น #26713 (จาก IP: 124.121.183.208)
ขอบคุณมากๆๆครับ |
จากคุณ
:
นัท / llnjllsjllsj_nutza@hotmail.com [2008-04-30 09:07:42]
|
 |
ความคิดเห็น #27699 (จาก IP: 125.24.132.4)
เพิ่มเติมนะครับ
สมมติ txtUrl="www.gogle.com" process.start(txtUrl.text)
อันนี้มันจะเรียกเปิดโปรแกรมขึ้นมาตามรูปไฟล์นั้นๆ ถ้าหาก IE เป็น default มันก็จะเปิด IE มาให้ครับ แต่ถ้าเป็นตัวอื่น เช่น firefox มันก็จะเป็น firefox ขึ้นมาแทน
และยังใช้ได้กับรูปแบบอื่นๆ ได้ เช่น เปิดไฟล์ word ไฟล์รูปภาพ และอื่นๆ โดยมันจะเรียกโปรแกรมที่เป็น default เพื่อทำการเปิดครับ |
จากคุณ
:
เอ็ม / snamlove@hotmail.com [2009-12-28 20:09:50]
|
 |
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
|
|