|
-
Mar 9th, 2002, 09:31 PM
#1
Thread Starter
Member
AUTORUN.INF - Run files from VB
Hi,
I need my VB application to open any file, depending on the file assotiation in the windows. Something like
shell "program.exe"
but not just *.exe files
For example if it's *.jpg, VB opens it with Adobe (or whatever is assotiated), if *.htm, VB opens it with IE.
What I actually need is to autorun the html page when I insert the CD in CD drive.
Thanks,
Best regards, Andrew
-
Mar 9th, 2002, 09:55 PM
#2
This may give you some ideas.
VB Code:
Option Explicit
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
Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
Dim strDir As String
On Error GoTo OpenErr
With CommonDialog1
.CancelError = True
.ShowOpen
End With
strDir = Left(CommonDialog1.FileName, 3)
ShellExecute Me.hwnd, vbNullString, CommonDialog1.FileName, _
vbNullString, strDir, SW_SHOWNORMAL
OpenErr:
End Sub
-
Mar 10th, 2002, 09:51 AM
#3
Thread Starter
Member
-
Mar 10th, 2002, 10:42 AM
#4
It is the Microsoft Common Dialog Control 6.0. You can find it under components.
-
Mar 10th, 2002, 08:46 PM
#5
Thread Starter
Member
Thanks
Thanks!!!
It works even without Common Dialog Control 6.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|