AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2006 Andrea Tincani
:: How to launch the Control Panel Extensions

Author  

Michael Rieder

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
API Declarations

Option Explicit

'API calls
Public Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Public 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
'API constants
Public Const SW_SHOWNORMAL = 1

Module

Public Function StartCPLApp(AppName As String) As Long
   
' AppName with ending
    Dim Scr_hDC As Long

    Scr_hDC = GetDesktopWindow()
    StartCPLApp = ShellExecute(Scr_hDC, "Open", "Control", AppName, "C:\", SW_SHOWNORMAL)
End Function

Usage

Private Sub Command1_Click()
    StartCPLApp "DESK.CPL"
End Sub

:: Navigation

Home

Miscellaneous Tips

Previous Tip

Next Tip

:: Search this site
Google
Web andreavb.com
:: Related Topics
icon 01-11-2004 Re: Window Service by Goran
icon 21-01-2004 Re: Creating an installer.. by yronium
icon 19-11-2002 Re: Win32 API function Launch process on different machine? by vbgen
icon 01-10-2002 Re: copy folder like windows explorer(vba excel 2000) by JLRodgers

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2006 Andrea Tincani