[AccessD] ShellExecuteA

MartyConnelly martyconnelly at shaw.ca
Thu Dec 1 19:06:43 CST 2005


Just a guess but are you doing
ShellExecute(frmMain.hWnd, "Open", sFileName, sParams, "", 1)

It might be faster to open to the desktop window handle

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, _
"", "C:\Temp\", SW_SHOWNORMAL)

See
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q170918

You could also try tickling the file to be active intially with
If Dir(CompleteFilePath, vbDirectory + vbHidden + vbSystem + vbReadOnly 
+ vbArchive) = "" Then
MsgBox """" & CompleteFilePath & """ cannot be found!", vbExclamation
end if

Of course the .pee files, could also be incontinent ;)

? Welz wrote:

> I'm back working full time for an old employer and have been asked to 
> refine and add features to an application I built a few years ago in 
> Access97 that was subsequently upgraded to a 2000 version and is now 
> running as 2000 in Access 2003.
>
> The problem I am currently experiencing has been blamed on the Access 
> application.
>
> I have a list box that displays file names (the path is stored hidden) 
> and when a user double clicks in the list, the path and file are 
> passed to ShellExecute and this has worked reliably and consistently 
> for several years. The listbox interface is useful because the files 
> are pulled from a variety of drives and related folders and can be 
> filtered and sorted on various attributes not possible in Explorer. 
> Three weeks ago one of our applications (.pee files) was upgraded to a 
> newer version.
>
> Immediately after the upgrade, users reported that .pee files were not 
> opening. The host application (MDI type) would open but my shell 
> wrapper reported that the file was not found. Double clicking the file 
> in the list again usually resulted in the file opening. I reported the 
> problem to the software company and modified my wrapper to first find 
> and open the executable for .pee files should it be such a file, sleep 
> for 5 seconds and then call itelf again with the file. This appeared 
> to have solved the problem ... but...
>
> Not for everyone and inconsistently. The list interface also has some 
> browse buttons that will open explorer displaying a particular 
> drive/folder. Double clicking on the files directly in Explorer will 
> quite consistently report that the file is not found while the caption 
> of the message and the text report the exact file that is highlighted. 
> The same with right click - open, though it will generally open after 
> a couple tries. If it is one of those users who is experiencing 
> problems, both the shell interface and the explorer view will fail 
> without error in opeining a subsequent file in the MDI. The file 
> simply doesn't open and there is no error even with open is selected 
> from the context sensitive menu in explorer.
>
> There is no question that writing the delay loop solved the problem 
> for some users, but not all users. Curiously, all our profiles are 
> essentially identical based on a clone of our standard user.
>
> I'm not happy with the kludge I've had to write in attempting to 
> mitigate the problem and I'm much unhappier about the fact that it 
> seems that ShellExecute is not launching files quite as consistently 
> as double clicking on files in Explorer.
>
> Ciao
> Jürgen Welz
> Edmonton, Alberta
> jwelz at hotmail.com
>
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.1.362 / Virus Database: 267.13.10/189 - Release Date: 30/11/2005
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list