Hi Frank,
First of all: NEVER EVER hard-code a path name to a browser. It's
completely pointless, it's wasting valuable space in your URL, and
completely throws away compatibility with future/past versions of
Windows, throws away the user's choice (a user can choose which browser
they prefer to run), etc.
Windows has the facility to find/launch the proper application for a
given path. (That's what happens when you double-click on a file in "My
Computer" or a similar interface.) Why not just pass the URL to that,
and let Windows deal with it?
chgvar var(&cmd) value('rundll32 url,FileProtocolHandler' *bcat &link)
strpco
monmsg iws4010
strpccmd pccmd(&cmd) pause(*no)
That doesn't solve your 123 character problem, of course.. but it
eliminates the nasty hard-coding of iexplore. There's another way to do
it that uses the ShellExecute() function of the operating system:
chgvar var(&cmd) value('rundll32 shell32,ShellExec_RunDLL' *bcat &link)
strpco
monmsg iws4010
strpccmd pccmd(&cmd) pause(*no)
However, I think Microsoft might've removed the RunDLL version of
ShellExecute from Windows 7? (I'm not sure I ever tried it, but I want
to say that someone told me that...) so you might want to use
FileProtocolHandler instead. (but test them both!)
In either case, it'll open whatever application Windows has configured
to handle that URL, it might be Internet Exploder (yuck!) or it might be
Firefox, Chrome, Safari, or Opera. Whatever the user has configured.
You can also point it to .DOC, .XLS, .PDF, etc files and it'll open them
with whatever the user has configured (probably Word, Excel, Adobe...
but whatever they configured/installed will be used.)
As for a batch file -- I used to use that technique many years ago, and
it can work okay, but I don't like it. Here are the reasons:
1) It's nearly impossible to escape special characters so they don't get
treated specially.
2) It's impossible to eliminate the ugly black DOS box from popping up.
3) On some emulation programs, the multiple successive STRPCCMDs (which
are required) will occur out of order. (I never understood that.)
Unless you add some delays, which of course, slow your program down.
But, if you really want to try the Batch file technique, here's a link
to an article I wrote about that back in 2005:
http://www.iprodeveloper.com/article/cl/launch-commands-longer-than-123-characters-on-the-pc-60996
On 8/8/2012 11:14 AM, fbocch2595@xxxxxxx wrote:
Hi Scott, thanks for the info.
Rob said to put the command(s) in a batch file but how is that done? What would the syntax look like? Currently, we use this code;
STRPCCMD PCCMD('"C:\PROGRAM FILES\INTERNET EXPLORER\IEXPLORE.EXE"' *BCAT &LINK) PAUSE(*NO)
So, would the .bat be the PCCMD?
Also, what would the other approach be?
Thanks, Frank
-----Original Message-----
From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Wed, Aug 8, 2012 11:05 am
Subject: Re: STRPCCMD and CPD0074
Hi Frank,
Changing this would break backward compatibility with 5250 emulators. If
ou changed it, you'd have to find every single 5250 emulator on the
arket (not just PC5250 from IBM i access, but all vendors) so I doubt
BM will ever do it.
My approach has been to determine the largest command length I'll need
eforehand, and only use STRPCCMD for things where a short command
tring is acceptable.
IF I need longer strings, I'll take another approach.
n 8/8/2012 9:19 AM, fbocch2595@xxxxxxx wrote:
Hi Folks, I'm getting msg CPD0074 which says PCCMD exceeds 123 characters in
ength. Has anything changed on the i to allow us to extend/increase the 123
ength? Will future releases increase the 123 limit? When CPD0074 happens what
o you folks do?
Thanks, Frank
As an Amazon Associate we earn from qualifying purchases.