看板 Visual_Basic 關於我們 聯絡資訊
我希望用ComboBox選單選到一個項目時, 就開啟瀏覽器連結到該網頁 我爬了文,看到ShellExecute()這個方法, 不過我用的時候會出現以下PInvoke的錯誤.. http://www.sendspace.com/file/oabzlp 請問是我哪裡寫錯了嗎? 原本想說直接呼叫不行,所以我用MSDN查到的方法, 設定Long變數來呼叫(就是下面button的寫法), 結果還是不行,會跳出一樣的錯誤訊息 ================ 程式碼 ================ Public Class Form1 Dim cbb2Arr() = {"青文", "東立"} Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cbb2.Items.AddRange(cbb2Arr) End Sub 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 cbb2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbb2.SelectedIndexChanged If cbb2.SelectedItem = "青文" Then ShellExecute(0, "open", "http://www.ching-win.com.tw/", 0, 0, 1) End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim r As Long r = ShellExecute(0, "open", "http://www.ching-win.com.tw/", 0, 0, 1) End Sub End Class -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.113.3.164 ※ 編輯: siaujan 來自: 59.113.3.164 (05/21 22:39)