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



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.