|
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Monday, April 16, 2007 7:44 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: URL in RPG, passing switches to browser or PC program
Hi John,
> Microsoft document
> http://support.microsoft.com/default.aspx?scid=kb;en-us;283225
> indicates the
> "url.dll,FileProtocolHandler" technique is old-school and
> "shell32.dll,ShellExecute" should be used instead. It appears that
> "ShellExecute" does allow params to be passed, but I'll be darned
> if it will work for me.
As far as I know, you can't call ShellExecute (which is an API) directly
via RunDLL. In order to run an API in a DLL via RunDLL, the API has to
be specifically designed for the RunDLL command -- and I don't think
ShellExecute is so designed. You'll notice that the URL you provided
to MSDN actually uses a Java class for ShellExecute rather than trying
to call it via RunDLL.
There is a variant of ShellExecute that's designed for RunDLL. It's
(aptly named) ShellExec_RunDLL. So you'd code the following in your RPG
program (via QCMDEXC or similar):
STRPCCMD PCCMD('rundll32 Shell32,ShellExec_RunDLL "mysheet.xls"')
And, although that's very interesting, it doesn't solve your actual
problem. You still can only pass one parameter (the name of the file to
open) to the ShellExec_RunDLL function. So I'm not sure that it really
helps you in any way to know about it!
However, the "start" command should get the job done. It's uglier
because of the extra command prompt window that it opens, but it'll work.
STRPCCMD PCCMD('start excel /r "mysheet.xls"')
I can't think of a better alternative right now, but if I think of one,
I'll share it.
johnking@xxxxxxx wrote:
All,STRPCCMD
A February thread in this list described how to use 'rundll32.exe' via
to access PC documents from an RPG application. This works well, butrundll32
only provides one parameter - the file name.url.dll,FileProtocolHandler
Executing the command: STRPCCMD PCCMD('rundll32
"mysheet.xls"') does indeed call Excel from a green-screen app, but doesnot
permit passing the /r 'read only' switch that prevents users fromaltering the
document. We would like to prevent that.the
Microsoft document
http://support.microsoft.com/default.aspx?scid=kb;en-us;283225 indicates
"url.dll,FileProtocolHandler" technique is old-school and"ShellExecute"
"shell32.dll,ShellExecute" should be used instead. It appears that
does allow params to be passed, but I'll be darned if it will work forme.
up with
Any number of variations of the string:
"STRPCCMD PCCMD('rundll32 shell32.dll,ShellExecute
0,"open","z:\mysheet.xls","/r","",5') " have been tried but they all end
a Windows error box "An exception occurred while trying to rununderstand
"shell32.dll,ShellExecute...". Am I just having trouble with single- and
double-quotes or is there something fundamentally deeper that I don't
about passing params to PC programs?
JK
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.