|
Данный пример покажет, как можно создать стандартное окно письма и запустить броузер для просмотра определенной страницы в Интернете. 'Вариант 1
'Добавьте на форму 2 элемента Label, скопируйте и
вставьте на форму следующий код:
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)
Private Sub Form_Load()
Label1.Caption = "http://www.vbnet.ru"
Label2.Caption = "bigsharig@mtu-net.ru"
End Sub
Private Sub Label1_Click()
Call ShellExecute(0, "Open", Label1.Caption, "", "c:\", 1)
End Sub
Private Sub Label2_Click()
Call ShellExecute(0, "Open", "mailto:" + Label2.Caption +
"?Subject=" + "Письмо для Гарика", "",
"", 1)
End Sub
'Вариант 2
Call Shell("Start.exe " & "http://www.vbnet.ru", 0)
Call Shell("Start.exe " & "mailto:bigsharig@mtu-net.ru", 0)
'Вариант 3
'Добавьте на форму 2 элемента Label, скопируйте и
вставьте на форму следующий код:
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 ExecuteLink(ByVal sLinkTo As String)
On Error Resume Next
Dim lRet As Long
Dim lOldCursor As Long
lOldCursor = Screen.MousePointer
Screen.MousePointer = vbHourglass
lRet = ShellExecute(0, "open", sLinkTo, "", vbNull, SW_SHOWNORMAL)
If lRet >= 0 And lRet <= 0 Then
Screen.MousePointer = vbDefault
MsgBox "Error Opening Link to " & sLinkTo & vbCrLf & vbCrLf &
Err.LastDllError, , "frmAbout::ExecuteLink"
End If
Screen.MousePointer = vbDefault
End Sub
Private Sub Label1_Click()
ExecuteLink "mailto:bigsharig@mtu-net.ru"
End Sub
Private Sub Label2_Click()
ExecuteLink "http://www.vbnet.ru"
End Sub
|
|