?
Solved

opening all types of files

Posted on 2003-03-05
3
Medium Priority
?
129 Views
Last Modified: 2010-05-01
I have a VB6 question:

In code, how do I open for example, an html file in Internet Explorer from my program. Or, a text file in Notepad. Or a bitmap in Photoshop. You get the idea.

Is there any way to open a file on a user's computer, using their default program for that file type?
0
Comment
Question by:vitanza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 8076084
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
Private Const SW_SHOWNORMAL = 1


Private Sub Command1_Click()
    ShellExecute 0, "open", "C:\Documents and Settings\bob\My Documents\FlightInfo.doc", vbNullString, vbNullString, SW_SHOWNORMAL

End Sub
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8076092
just replace C:\Documents and Settings\bob\My Documents\FlightInfo.doc with the path to whatever file you want to open (sorry, i forgot to change it before posting) ;)
0
 

Author Comment

by:vitanza
ID: 8076342
Thanks, that's exactly what I wanted!
Also, do know any sites where I can get more info on shell commands?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 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