Hi, how can i launch an application using a file of this application 
Author Message
 Hi, how can i launch an application using a file of this application

Hi i need to launch an application For example Microsoft Photo Editor giving
the name of a gif file

Thanks


Fri, 26 Apr 2002 03:00:00 GMT  
 Hi, how can i launch an application using a file of this application


Quote:
>Hi i need to launch an application For example Microsoft Photo Editor giving
>the name of a gif file

>Thanks

You need to use the ShellExecute API function. It's use is as follows:

' In a standard module

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

Public Const SW_HIDE = 0
Public Const SW_MINIMIZE = 6
Public Const SW_RESTORE = 9
Public Const SW_SHOW = 5
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1

' In the event of your choice

    Dim lngRetVal As Long

    lngRetVal = ShellExecute(Me.hwnd, "open", "C:\Temp\MyGif.Gif", vbNullString,
"C:\Windows\Temp", SW_SHOWNORMAL)

Change the "C:\Temp\MyGif.Gif" to a string specifying the file you want to open.
Change the "C:\Windows\Temp" to the directory you want to open the file in. The
SW_SHOWNORMAL parameter can be changes to any of the public constants listed.
They're pretty self explanitory. :)

Hope this helps....

Sheppe Pharis, MCP * 3/TekMetrics VB Certified
VB5/VB6/VBS/ActiveX Developer



Fri, 26 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using the ShellExecute to launch a file with associated application

2. Launching an application using a file's extension

3. Launching Windows 95 applications from your VB application

4. launch application using registry??

5. Launching MS Application using Vbscripting

6. Help Using VBScript To Launch Client Side Applications

7. launch an application using html/asp

8. Using VBScript to launch applications

9. how to launch an Access Application (mdb file) from VB.Net

10. launching a file from an application

11. Quirkiness Launching HTML Help File in Application

12. Launching registered application based on file type

 

 
Powered by phpBB® Forum Software