Solved

VB6 Shell

Posted on 2011-03-17
2
568 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

623 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