Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 Shell

Posted on 2011-03-17
2
Medium Priority
?
570 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

688 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