Connecting Tech Pros Worldwide Forums | Help | Site Map

ShellExecute and MS Photo Editor

Neil
Guest
 
Posts: n/a
#1: Mar 10 '06
I am using ShellExecute to open JPG files with the associated application,
MS Photo Editor, from within an Access 2000 application. When the code is
run the first time (Photo Editor closed), there's a blinking in my
application title bar, and nothing appears. Then, if I do it a second time,
Photo Editor appears, but with two copies of the image. And, as long as
Photo Editor stays open, the images open fine. But if it's closed, it takes
two times to get it open.

This doesn't happen with MS Picture and Fax Viewer as the default
application. With Picture and Fax Viewer, the same code opens it up
immediately. However, users have MS Photo Editor as their default app, and
they prefer it.

Anyone know what's going on with MS Photo Editor here? Code is below.

Thanks,

Neil

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 Function OpenFile(strPath As String, strFilename As String)

Call ShellExecute(Application.hWndAccessApp, "open", strFilename,
vbNullString, strPath, 0)

End Function



Tom Esh
Guest
 
Posts: n/a
#2: Mar 10 '06

re: ShellExecute and MS Photo Editor


On Fri, 10 Mar 2006 17:29:47 GMT, "Neil" <nospam@nospam.net> wrote:
[color=blue]
>I am using ShellExecute to open JPG files with the associated application,
>MS Photo Editor, from within an Access 2000 application. When the code is
>run the first time (Photo Editor closed), there's a blinking in my
>application title bar, and nothing appears. Then, if I do it a second time,
>Photo Editor appears, but with two copies of the image. And, as long as
>Photo Editor stays open, the images open fine. But if it's closed, it takes
>two times to get it open.
>
>...[/color]
[color=blue]
>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 Function OpenFile(strPath As String, strFilename As String)
>
> Call ShellExecute(Application.hWndAccessApp, "open", strFilename,
>vbNullString, strPath, 0)
>
>End Function[/color]

I don't have PhotoEditor here to test it, but part of the problem may
be the nShowCmd arg. 0 equates to SW_HIDE, so unless the app overrides
it (which PE apparently does not), you end up launching an instance
with no visible UI. Change it to SW_NORMAL (1) and see what happens.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Closed Thread