Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Help - running and EXE

Status
Not open for further replies.

redlair

Technical User
Joined
Jun 29, 2004
Messages
54
Location
US

I need to be pointed in the right direction. I need to start/run a EXE from VB. I also will need to modify a line in a .INI file from the VB app. Please any help will help.
 
Use these API calls for simple INI read/write:
Code:
'Win32 API for reading INI file:
Private Declare Function GetPrivateProfileString Lib "kernel32" _
        Alias "GetPrivateProfileStringA" _
        (ByVal lpApplicationName As String, _
        ByVal lpKeyName As Any, _
        ByVal lpDefault As String, _
        ByVal lpReturnedString As String, _
        ByVal nSize As Long, _
        ByVal lpFileName As String) As Long

'Win32 API for writing to INI file:
Private Declare Function WritePrivateProfileString Lib "kernel32" _
        Alias "WritePrivateProfileStringA" _
        (ByVal lpApplicationName As String, _
        ByVal lpKeyName As Any, _
        ByVal lpString As Any, _
        ByVal lpFileName As String) As Long

Do a search on this or other sites and you can probably find a really nice INI class that you can just pop into your project. I have one around here somewhere....

 
If you just need to kick off a regular windows EXE in the context of the current user then use VB's Shell() function.

If you need to run it as someone else then you'll have to go with an API routine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top