This sample diagram looks for a program - any program - currently running on the LEGO® NXT Brick. It displays the name of the program, and optionally stops and restarts the program.
Double-click on the CheckForProgram activity. This will open up a second diagram. Take a look at the beginning of the diagram on the left. The first step calls QueryRunningProgram from the NxtBrickIO service.
This operation will return a fault when no program is running, otherwise, it will return the name of the program.
StopProgram will stop any program currently running on the NXT Brick. Once the program is stopped, the diagram prompt's the user to start the program again, and then calls StartProgram with the name of the original program.