Solved

VB6 Shell

Posted on 2011-03-17
2
567 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
[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
2 Comments
 
LVL 6

Expert Comment

by:rbgCODE
ID: 35162388
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
ID: 35162395
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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