× 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.



I understand all you said. ShellExecuteA is what I was using in a
Visualage for RPG program I had (I know, old and ancient). I ran across
examples for STRPCCMD and RUNRMTCMD in the archives, but the paths to
the PC files will be too long for the 123 character limit on the
STRPCCMD command. Users will be drilling down several folders with
large folder and file names (hundreds of characters). There's a way to
do is, I just need to find it!






Bob Ostrowski | Senior Programmer/Analyst
TRAINOR GLASS COMPANY | National - IT
11901 S. Austin Ave. | Alsip, IL 60803
T 708.293.4218 | F 708.293.6218 | C 708.560.5813
bob.ostrowski@xxxxxxxxxxxxxxxx | www.trainorglass.com






-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, July 08, 2011 1:07 PM
To: RPG programming on the IBM i / System i
Subject: Re: ShellExecuteA

hi Robert,

On 7/8/2011 8:52 AM, Robert Ostrowski wrote:
Is there an equivalent of ShellExecuteA that can be run from an
RPGIV program to open a file on the user's PC?

You seem to be oversimplifying the situation a bit.

ShellExecuteA is part of the Microsoft Windows operating system. To
call an API that's running on Windows, you need a PROGRAM THAT'S RUNNING

ON WINDOWS. (Hopefully that's already obvious to you.)

So in order to do what you're asking, you're going to need a lot more
than the ability to call a ShellExecute API (or the older, legacy,
version, ShellExecuteA)

You're going to need:
1) A program on Windows to call the API
2) A means of communication between the RPG IV program and the Windows
program
3) Something to keep it secure (so only authorized programs can run
commands on the PC. Obviously, letting anyone/everyone in the world run

any arbitrary command on the PC would be a bad idea.)

One way that already exists is to use the 5250 emulator. If you have an
interactive user who's already connected from the PC to IBM i using a
5250 emulator, then the communication is already in place, and the
security has already occurred. You can use the 5250 emulator's support
for the STRPCCMD CL command to run a command on that PC. If you want to

force it to use ShellExecute(), you can do this:

STRPCCMD PCCMD('rundll32 shell32,ShellExec_RunDLL command-here')

This does not run ShellExecuteA, but another API named ShellExec_RunDLL.

There are options in ShellExecuteA that ShellExec_RunDLL doesn't have
in order to keep ShellExec_RunDLL compatible with the rundll32.exe
program in Windows. But, they serve the same basic function.

Another disadvantage to this method is that it's really hard to
trap/handle errors.

The other alternative, of course, is to write a Windows program and use
some other communications method. Then you can make it work exactly the

way you want to -- but you'll need to write Windows software,
communications software, and make that software available to run on all
of the PCs. (That might be very easy, or very hard, depending on your
environment -- which I know nothing about.)

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.