Solved

Openning a file using it's own program

Posted on 1998-12-13
2
155 Views
Last Modified: 2010-05-03
I'm trying to have the user click on a button and
launch a file, be it .wav or .avi or .pdf
according to the windows' file/program association

are there any methods kinda like the shell method? (except an .exe is not specified)

thanks
0
Comment
Question by:atsui
2 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
ID: 1449844
You can use ShellExecute to do so.
Put the declaration in the General declarations section on your form:
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


'Put this in the place you want to run the file:
Dim X as long
X=ShellExecute(Me.hwnd, "open", "C:\Docs\MyFile.Avi", vbNullString, App.PAth, vbShowNormal)
0
 
LVL 12

Expert Comment

by:jgv
ID: 1449845
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now