[hobbit] ShellExecute api call
Henrik Stoerner
henrik at hswn.dk
Tue May 9 09:29:10 CEST 2006
On Mon, May 08, 2006 at 12:37:59PM -0400, Jeffcoat, Al wrote:
>
> I've got a programmer here trying to send a status message to hobbit
> from a windows machine. He's having a problem executing the bb code. I
> myself am not a programmer, so I figured I'd pass on his e-mail and see
> if anyone else knows the answer to his problem.
>
> There is a problem doing this from within a program. The shellexecute
> function requires you to pass the program name and parameters seperate.
>
> program = "bb.exe"
>
> parameters = "hobbit status kn306109.dtr-status red
> <center>DTR-STATUS</center><br>Last Failure = 05/04/20 06 00:00:01 Last
> Success = 05/08/2006 00:00:01<br>Copies = 50"
I suspect some sort of quoting is needed to pass this as the two
parameters bb.exe expects - first the IP/hostname of the server, then
the actual status message.
I browsed through the MSDN site, and came across the docs for the
ShellExecuteEx function - at the bottom there is an example of
how to quote parameters. Perhaps this applies to ShellExecute
as well:
To include double quotation marks in lpParameters, enclose each
mark in a pair of quotation marks, as in the following example.
sei.lpParameters = "An example: \"\"\"quoted text\"\"\"";
In this case, the application receives three parameters: An,
example:, and "quoted text".
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/structures/shellexecuteinfo.asp
Obviously, bb.exe doesn't want the quotes, but perhaps it should be done
as
parameters = "hobbit \"status kn306109.dtr-status red <center>DTR-STATUS</center><br>Last Failure = 05/04/20 06 00:00:01 Last Success = 05/08/2006 00:00:01<br>Copies = 50\""
Regards,
Henrik
More information about the Xymon
mailing list