× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott, Rory,

Thanks for the tips. Our in-house document management system runs from
green-screen, calling Excel, WinZip or Acrobat with the fully-qualified file
name + params via STRPCCMD. This works fine in our cozy little office where
all the desktops are alike, but blows, when someone jacks-in with a laptop
or comes in via telnet with a different PC configuration.

I believe that the "start" command will be the best solution for us,
letting the Windows registry do the work of calling the correct program
based on the IFS file extension.

It is interesting to note that I could find absolutely no mention of
"ShellExec_RunDLL" anywhere on the Microsoft website - neither the Support
KB nor the search from their main page. Have to go to the off-site forums
for any information at all. I'll try to remember that next time I'm
grumbling about trying to find something on the IBM site <grin>!

JK

-----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,

A February thread in this list described how to use 'rundll32.exe' via
STRPCCMD
to access PC documents from an RPG application. This works well, but
rundll32
only provides one parameter - the file name.

Executing the command: STRPCCMD PCCMD('rundll32
url.dll,FileProtocolHandler
"mysheet.xls"') does indeed call Excel from a green-screen app, but does
not
permit passing the /r 'read only' switch that prevents users from
altering the
document. We would like to prevent that.

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.

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
up with
a Windows error box "An exception occurred while trying to run
"shell32.dll,ShellExecute...". Am I just having trouble with single- and
double-quotes or is there something fundamentally deeper that I don't
understand
about passing params to PC programs?

JK



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.