Ok, I have done that. My codes:
'Declaration
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
' My ASP Page calls this function
Public Function ResponseRedirect(ByVal v_strYTLAdd As String) As Long
Call ShellExecute(0&, vbNullString, "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL)
Exit Function
End Function
This function requires me to return a value to the calling asp page. I would like to return the error code whether it is successfull or not. How do I do this?
Main Topics
Browse All Topics





by: SethiPosted on 2003-02-04 at 22:00:10ID: 7880527
There are two of ways by which you can do this.
First Method
Use the Shell Function In VB.
Second Method
Use ShellExecute API.
Example:
In case you wish to open a single instance of IE then in Declartion section declare the following code:
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
On click of a command button write the follwoing code:
ShellExecute hWnd, "open", "C:\Program Files\Internet Explorer\IEXPLORE.EXE", " http://www.yahoo.com", vbNullString, 1
In case you wish to open multiple sessions of IE through VB then this is the way to do it:
ShellExecute hWnd, "open", "C:\Program Files\Internet Explorer\IEXPLORE.EXE", " http://www.yahoo.com", vbNullString, 1
ShellExecute hWnd, "open", "C:\Program Files\Internet Explorer\IEXPLORE.EXE", " http://www.rediff.com", vbNullString, 1
ShellExecute hWnd, "open", "C:\Program Files\Internet Explorer\IEXPLORE.EXE ", "http://www.google.com", vbNullString, 1
Pass the required URL's instead of yahoo and google.