files opened with ShellExecuteA (shell32.dll) appear behind Progress Window

Hi All,

I'm using Progress window, which uses ShellExecuteA (shell32.dll), to
open Word and Excel files on a WinXP client.

The problem is that the file opens successfully, but the window is placed
behind the application i.e. Word, Excel. Its pushed back and goes back to the Progress window where I pressed a button to open a file. File application should stay in front until I close it.

Do you know how to do this? If ShellExecuteA returns the handle, I would be able to use setforeground to set it, but it is not possible.

many thanks
Melly


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

bonjorno!

With inatem! Merry Christmas!


alternative: OS-COMMAND start

I tried the "start" command from a button and I don't have the problem you described.
Sample code:
DEFINE VARIABLE cFullPathName AS CHARACTER NO-UNDO INITIAL "C:\some word document.doc".
OS-COMMAND NO-WAIT VALUE(SUBSTITUTE('start "title" "&1"':U, cFullPathName)).


alternative 2: Wscript.Shell Run

Another way to do it that seems to work:

DEFINE VARIABLE cFullPathName AS CHARACTER NO-UNDO INITIAL "C:\some word document.doc".
/*DEFINE VARIABLE cFullPathName AS CHARACTER NO-UNDO INITIAL "http://www.progress.com".*/

DEFINE VARIABLE objAppWScript AS COM-HANDLE NO-UNDO.

CREATE "Wscript.Shell":U objAppWScript.
objAppWScript:Run(QUOTER(cFullPathName)).
RELEASE OBJECT objAppWScript NO-ERROR.


Further info

Thanks very much. It works if I create a button on the normal window, but...

It seems a problem if you add folder98.w (tab folders) on the screen and it has a browse window on the tab folder. it opens application then back to the progress window.


jurjen's picture

Re: files opened with ShellExecuteA (shell32.dll) appear behind

Hi,

You say that ShellExecute does not return a handle. That's correct, but you may try ShellExecuteEx or CreateProcess instead because those functions do return handles.
However, those handles are process handles, not window handles. You would have to use EnumWindows to identify the main window in that process, which is a daunting task in Progress.

But it won't help anyway, because the real problem is not how you send the application to the foreground, but how to prevent your Progress window from taking the foreground again. After all, when you press a button in a (Progress) window you implicetely force that window to the foreground. Perhaps a "return no-apply" statement near the end of the "on choose" trigger may help.

Regards,
Jurjen


Problems using os-command

Hi everybody, i'm new with this language, i tried to use the os-command to open a tiff file, when i execute this command and the compiled file is located on windows, the tiff file is sucessfuly open, but ,when the compiled file is on a shared linux server, the command does nothing, why is this? do i need to use another command? it's because the compiled file is on a shared linux server?
Please, help me out with this little problem.
Thanks a lot¡¡


tamhas's picture

There are a few missing

There are a few missing details, but it sounds to me like you are just opening the file and in the Windows context there is a default application defined for TIFF, but on the Linux side there isn't. You need to tell it what application to use.