Unicode Controls & Classes for VB6 - Version 4

clsCommonWrapper.UniShellExecuteW Function

Performs an operation on a specified file. Check MSDN for details

Syntax
Public Function UniShellExecuteW (ByVal hWnd As Long, _
ByVal sExecute As String, _
Optional ByVal iOperation As eCtlShellExec = esew_open, _
Optional ByVal sParameters As String = "", _
Optional ByVal sWorkingDir As String = "", _
Optional ByVal WindowStyle As VbAppWinStyle = vbNormalFocus) As Long
Parameters
Parameter Description
ByVal hWnd As Long A handle to the parent window used for displaying a UI or error messages. This value can be NULL if the operation is not associated with a window.
ByVal sExecute As String Specifies the file or object on which to execute the specified verb. To specify a Shell namespace object, pass the fully qualified parse name. Note that not all verbs are supported on all objects. For example, not all document types support the "print" verb. If a relative path is used for the lpDirectory parameter do not use a relative path for lpFile.
Optional ByVal iOperation As eCtlShellExec = esew_open Specifies the action to be performed. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs. The following verbs are commonly used:
Optional ByVal sParameters As String = "" Specifies the parameters to be passed to the application. The format of this string is determined by the verb that is to be invoked. If lpFile specifies a document file, lpParameters should be NULL.
Optional ByVal sWorkingDir As String = "" Specifies the default (working) directory for the action. If this value is NULL, the current working directory is used. If a relative path is provided at lpFile, do not use a relative path for lpDirectory.
Optional ByVal WindowStyle As VbAppWinStyle = vbNormalFocus The flags that specify how an application is to be displayed when it is opened. If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it. These values are defined in Winuser.h.
Remarks
If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. It is not a true HINSTANCE, however. It can be cast only to an int and compared to either 32 or the following error codes below.

In this sample we'll open the Google homepage using the default browser
Option Explicit

Private Sub Form_Load()
Dim ow As New clsCommonWrapper
Dim lRet As Long
lRet = ow.UniShellExecuteW(Me.hWnd, "http://www.google.com", esew_open, "", "", SW_SHOWNORMAL)
MsgBox (lRet > 32) 'MSDN
End Sub