PDA

View Full Version : طریقه ی باز کردن یک سایت



ho3ein.3ven
جمعه 21 بهمن 1390, 12:03 عصر
با سلام
چطور میشه وقتی روی یک کامند کلیک میشه یک سایت باز بشه ؟
کامپوننت urllabel رو نمی خوام .
با تشکر

محسن واژدی
جمعه 21 بهمن 1390, 12:25 عصر
سلام
هم میتوانیم از Shell و هم از api برای باز کردن url استفاده کنیم:
Shell

Private Sub Command1_Click()
Shell "explorer http://google.com", vbNormalFocus
End Sub


API

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 Command1_Click()
ShellExecute Me.hwnd, "open", "http://google.com", vbNullString, vbNullString, vbNormalFocus
End Sub


موفق باشید