Got this from
A document at JSIINC.com suggests the following...
0986 » How do I tune ill-behaved apps to be good Terminal Server citizens?
If a 16 or 32 bit application uses too many cycles when idle, you can tune the performance by editing the registry. Use Regedt32 to navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\TerminalServer\Compatibility\Applications
Add Key name YourApplicationExe (without the extension). Leave the Class blank.
Add the following 4 Value names as type REG_DWORD entries: (see the SETUP sub-key if you rather Save Key and Restore):
FirstCountMsgQPeeksSleepBadApp - The default is 0xf (15). This is the number of times the application must query the message queue before Terminal Server decides that it is ill-behaved. Decrease this value to put the application to sleep more often, so it uses less CPU time.
MsgQBadAppSleepTimeInMillisec - The default is 0x1 (1). This is the number of milliseconds the application is suspended when Terminal Server has decided that it is ill-behaved. Increase this value to use less CPU time. If this value is zero, polling detection is disabled.
NthCountMsgQPeeksSleepBadApp - The default is 0x5 (5). This is the number of times the application must query the message queue before it is suspended again. Decrease this value to use less CPU time.
Flags - The default is 0x8 (8). The possible values are:
0x4 (4) for Win16 applications only.
0x8 (8) for Win32 applications only.
0xC (12) for either Win16 or Win32 applications.
You should run performance monitor while tuning the application.
You may want to have a look at the compatibility bits utility which does this graphically for you.
Here is a document from the Citrix KB that explains how to tune your application to make it behave.
Performance Tuning CPU Usage on 16-bit and 32-bit Windows Applications
Synopsis:
Depending on how an application is written, it is possible that a 16-bit or 32-bit Windows application may use too much CPU time even when it`s idle (no keyboard or mouse events).
Details:
This technote documents the use of WinFrame`s polling detection mechanism for Windows 16-bit and 32-bit applications. Some applications constantly look for keyboard input even while they appear to be doing nothing, thereby consuming a great deal of system CPU. WinFrame has built-in logic to detect this behavior. When this type of behavior is detected, the application`s execution is suspended, allowing other applications to utilize the CPU and making multitasking much more efficient. It is necessary to instruct WinFrame to look for this behavior by adding information to the Registry that is specific to the application in question.
Modifying the Registry
1. Run REGEDT32.EXE and locate the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Compatibility\Applications
2. Double-click the Applications subkey to reveal several application settings that are pre-defined. Select SETUP under the Applications subkey. The following values are displayed on the right side of the Registry Editor window:
FirstCountMsgQPeeksSleepBadApp:REG_DWORD:0xF
Flags:REG_DWORD:0xc
MsgQBadAppSleepTimeInMillisec:REG_DWORD:0
NthCountMsgQPeeksSleepBadApp:REG_DWORD:0x5
3. With the SETUP subkey highlighted, select Save Key from the Registry pull-down menu. The filename can be anything, such as SETUP.REG. Once the SETUP values are saved, you need to create a subkey for your application.
4. With the Applications subkey highlighted, choose Add Key on the Edit pull-down menu. Set the Key Name field to the name of the executable in question, minus the extension. For example, for the application MYAPP.EXE, type MYAPP in the Key Name field. Leave the Class field blank. Click OK.
5. To copy the values from the SETUP subkey, select your new subkey (for example, MYAPP) and choose Restore from the Registry pull-down menu. Choose the filename you created in Step 3. Click Yes when the warning dialog box is displayed. Your new application subkey now has the same values as the SETUP subkey.
6. You must now fine tune the values for your application. The values are described in the following sections.
"Bad Application" Registry Values
The default values for the bad application settings are:
FirstCountMsgQPeeksSleepBadApp = 0xF
MsgQBadAppSleepTimeInMillisec = 0x1
NthCountMsgQPeeksSleepBadApp = 0x5
Flags: 0x8
FirstCountMsgQPeeksSleepBadApp is the number of times the application must query the message queue before WinFrame decides that it is ill-behaved. Decrease this value to put the application to sleep more often so it uses less CPU time.
MsgQBadAppSleepTimeInMillisec is the number of milliseconds the application is suspended once WinFrame has decided that it is ill-behaved. Increase this value to use less CPU time. If this value is zero, polling detection is disabled.
NthCountMsgQPeeksSleepBadApp After the application is determined to be "bad," this setting is the number of times the application must query the message queue before it is suspended again. Decrease this value to use less CPU time.
Flags is set to a value corresponding to the type of Windows application. Valid values are:
0x4 for Win16 applications only
0x8 for Win32 applications only
0xC for either Win16 or Win32 applications
"Bad Application" Settings
All values are expressed in hexadecimal. When changing the values, first click
the Decimal button and input the decimal value. For instance, if you want the MsgQBadAppSleepTimeInMillisec value to be set to 200 milliseconds, perform
the following steps:
1. Double click MsgQBadAppSleepTimeInMillisec
2. Click the Decimal radio button
3. Enter 200 in the Data field
4. Click OK
The value is now converted to 0xc8, the hexadecimal equivalent of 200 decimal.
NOTES:
1. To modify polling detection for DOS applications, use the DOSKBD utility.
2. When tuning these parameters, make sure the Performance Monitor up and running. These parameters will affect the amount of CPU used by an application. These parameters usually trade off CPU usage versus application responsiveness.