Programmatically Changing the Backlight, Contrast, Registry, Buzzer, Reboot of the TPC-2006Primary Software: LabVIEW Modules>>Touch Panel ModulePrimary Software Version: 1.0 Primary Software Fixed Version: N/A Secondary Software: N/A Hardware: Industrial Communications>>HMI and Industrial PC>>TPC-2006
Problem: I want to programmatically change settings on my TPC-2006, such as turning the screen on or off or saving the registry. What methods are available for this? Solution: The image for the TPC includes several helper executables that can be called programmatically by using a Call Library Node. Certain Control Panel settings are stored to the registry and the registry can also be written to programmatically. Using helper executables from a Call Library Node Bright.exe [Level] Sets the brightness level of the display. The parameter is from 1 to 10. Buzzer.exe [frequency] [duration] Plays a beep. Use parameters to decide the frequency (units: Hz) and duration (units: ms). If you don't use any parameters the default frequency is 350 Hz and the default duration is 350 ms. Contrast.exe [Level] Sets the contrast level of the display. The parameter is from 1 to 10. RegSave.exe [-s] Saves registry settings. If you use the parameter -s, no message box is displayed. Saving the registry is useful when you install a program on your target that modifies the registry. If you were to disconnect power from the TPC-2006 after the registry had been modified but it had not yet been saved, the changes would be lost. Reboot.exe Saves the registry and reboots the unit. Screen.exe [on/off] Turns the display on/off. Use "Screen on" to turn on and "Screen off" to turn off the display. Call these EXEs from a call library node using the LVCreateProcess function. For example:LVCreateProcess("screen.exe", "off");A stub dll with the function prototype for LVCreateProcess must be included with the project and the source .cpp file must be included as an external file in the Build Specifications of the executable. The following is the code from the .cpp file. See the attached example LVCreateProcess.zip.
========Editing registry keys for Control Panel settings Many Control Panel settings are stored to the registry. For example, whether the backlight turns off after a certain period of inactivity can be set in the Display dialog box of the Control Panel. These settings can be modified manually by programmatically writing to these registry keys using the Windows CE API for writing to the registry. See the link below to MSDN. For example, the registry key for determining whether the backlight turns off after a certain period of inactivity is HKEY_CURRENT_USER\ControlPanel\BackLightFor an example of how to call external code with the TPC-2006, see the shipping example Calling External Code - Touch Panel. NOTE: Editing the registry carries inherent risks. Make sure you are familiar with the registry before editing the registry, manually or programmatically. Making a backup is always a good idea. Related Links: MSDN: Windows CE 3.0 API Reference: Registry Functions Attachments:
Report Date: 11/22/2006 Last Updated: 03/07/2007 Document ID: 43LINATQ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
