Solved

VB6 Shell

Posted on 2011-03-17
2
563 Views
Last Modified: 2012-05-11
I have the following code working:

runExe = Shell("C:\Program Files\Jasc Software Inc\Paint Shop Pro 8\Paint Shop Pro.exe " & stored_file, vbMaximizedFocus)

And it opens the picture in Paint Shop Pro, like it's supposed to.  I would like to save a step if Paint Shop Pro is already open, but this doesn't work:

runExe = Shell(stored_file, vbMaximizedFocus)

I thought it would use whatever program is associated with the file type, in this case .jpg, but it isn't working.
0
Comment
Question by:hrolsons
  • 2
2 Comments
 
LVL 6

Expert Comment

by:rbgCODE
Comment Utility
there is a special api you can use that will instead of using runEXE you actually call windows API to manage opening the file...

0
 
LVL 6

Accepted Solution

by:
rbgCODE earned 500 total points
Comment Utility
wooops, forgot the code.. here it is.


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

Public Sub xstart(xpath As String)
 Call ShellExecute(hWnd, "Open", xpath, "", App.Path, 1)
End Sub

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 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

11 Experts available now in Live!

Get 1:1 Help Now