|
Hi Tim,
CHGVAR &CMD +
VALUE('rundll32.exe url.dll,FileProtocolHandler ' *bcat +
'http://www.site.com')
STRPCCMD PCCMD(&cmd) PAUSE(*no)
I recently stumbled over this exact same technique (in fact, I was planning to mention it in a newsletter that I'm writing for Thursday). I like this method better than using the "start" command, because "start" is an MS-DOS command, and it causes the ugly MS-DOS window to open! The "start" command also chokes on any embedded ampersands (the & character) in the URL, and that's often a problem. So I really like the rundll method because it solves all of these, yet still will invoke the user's default browser.
I did want to point out that you can save a few precious characters in your URL string by leaving off the "exe" and "dll". For example:
code for LAUNCH *CMD:
CMD PROMPT('Launch Browser')
PARM KWD(URL) TYPE(*CHAR) LEN(90) MIN(1) +
EXPR(*YES) PROMPT('URL to launch')
code for LAUNCH CL program:
PGM PARM(&URL)
DCL VAR(&CMD) TYPE(*CHAR) LEN(123)
DCL VAR(&URL) TYPE(*CHAR) LEN(90)
STRPCO PCTA(*NO)
MONMSG IWS4010
CHGVAR VAR(&CMD) +
VALUE('rundll32 url,FileProtocolHandler ' *BCAT &URL)
STRPCCMD PCCMD(&CMD) PAUSE(*NO)
ENDPGM
Whenever I want to launch a browser window with this technique, I simply
do the following:
LAUNCH URL('http://www.scottklement.com')
Of course, this technique will only work if the attached terminal supports
STRPCCMD, and is running a 32-bit version of Windows. And it's still
limited to 90 characters for a URL. But, that's often adequate.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.