I have emailed X10 about this problem. There has been no response so far, but this might explain your problem:
The issue with the SDK is that the ahscript.dll file supplied in the SDK is version 3.0.0.183 while the version supplied with AHP is 3.0.0.200. The most obvious problem with this is that software that uses the SDK version of the file gets erroneous results when attempting to use the “queryplc” command. Many that have tried to develop software using the SDK have complained that the “queryplc” command always returns a result of 0. Granted this is only an issue if the developer or end user doesn’t have AHP installed, or the developed software accesses a local copy of ahscript.dll instead of the one installed by AHP, but it does lead to a lot of frustration when trying to develop software and the “queryplc” command doesn’t appear to work.
Bill's info is above is correct.
I could not remember why query plc was working for me, so I did a test just now.
I am able to make query plc work only if the module I am inquiring about is actually installed in AHP.
I don't use AHP and it is not running at the time I do my queries, but I do have it installed on the PC that is doing the queries with my VB 2008 express program.
If I do a query on a module that is not set up in AHP, I get a zero on the query, even if the module is actually on.
This does not help developers who want to distribute their software to people who do not have AHP installed.
If you do have AHP installed on your PC and are only doing personal stuff with your own programs, go ahead and add the modules to AHP that you need to query.
Test this and see if it works for you after doing that.
Here's a screen shot of me doing my test on G16 module.
I have the G16 module installed in AHP, but AHP is not running.
I am turning G16 on and off with the buttons at the bottom of the form.
I am doing the query with the button at the bottom of the form after turning the module on or off.
The lines below each query are an x10 traffic monitor reporting what x10 traffic has been received.
I finally got around to doing a proper test on this theory.
I renamed my .ahx file and forced AHP to start with a new empty file, i.e. no rooms, modules or macros defined.
I cleared the interface and then downloaded the empty .ahx setup.
In the downloaded setup, the "Monitored House Code" was "L" and I changed the transceived house code selections so that all house codes are transceived.
I then ran a JScript program I had written some time back that uses queryplc to show the status of modules.
The "Monitored House Code" (house code "L") modules jumped right up with their status.
The other addresses came up as "undefined".
As a test, I used a plug-in stand-alone X10 controller to send "P2 On" and "P2 Off" commands (pressing the "Refresh Staus" button in my program after each command).
The "Non-Monitored" P2 address changed appropriately from "undefined" to "On" then "Off" ad infinitum, as expected.
My conclusion is that, as I believed, queryplc reports the correct module status even if the module is not defined in AHP or the CM15A.
Only modules assigned to the "Monitored House Code" will be tracked by the CM15A when the computer is off.
When the computer is on, the X10 service will track all module states, but once turned off and restarted, the X10 service will report "unknown" as the module state of any module that is not on the "Monitored House Code" until it sees a command for the non-monitored module.
Clear as mud?