WCheckCheck()/WCheckUnCheck() Do Not Cause Click for Check Box

ID Number: Q85757

1.00

WINDOWS

Summary:

The WCheckCheck() and WCheckUnCheck() procedures (located in

TESTCTRL.DLL) are used to place a check in a check box or to remove a

check from a check box, respectively. However, these procedures do not

generate a click for the check box; they just place a check in an

indicated check box, or remove a check from an indicated check box. To

generate a Click event, use the WCheckClick() procedure.

This information applies to Microsoft Test version 1.0 for Windows.

More Information:

The following code will place a check in a check box with the caption

"Test", and remove a check from a check box captioned "Change". (This

code assumes you have a Windows application program running with two

check boxes using the captions listed below. It also assumes that the

"Test" and "Change" check boxes are unchecked):

'$DEFINE W_CHECK

'$INCLUDE 'MSTEST.INC'

WCheckCheck("Test")

WCheckUnCheck("Change")

(Note: This example will not work for Visual Basic applications,

because Visual Basic check boxes are not of the standard Windows class

"Button".)

If your application performs some action based on the Click of either

of these check boxes, you will notice that the check either appears or

disappears from the check box as expected, but no Click event is

issued. The same is also true for the WOptionSelect() procedure.

The reason for this is that WCheckCheck(), WCheckUnCheck(), and

WOptionSelect() send the specified control a BM_SETCHECK message. The

BM_SETCHECK message does not generate a WM_COMMAND message to the

control's parent, which is what happens when you click on a check box

or option button. The benefit of this is that a test can be set up to

simulate a user's input without it actually affecting the host

program's operation.

To generate a Click event on a check box after checking it, use the

WCheckClick() procedure directly after the WCheckCheck() /

WCheckUnCheck() procedure. The WCheckClick() performs the equivalent

of a left mouse button click on the specified check box within the

active window. The code below is the same as above, with this

modification to send a Click event after the check box has been

checked:

'$DEFINE W_CHECK

'$INCLUDE 'MSTEST.INC'

WCheckCheck("Test")

WCheckClick("Test")

WCheckUnCheck("Change")

WCheckClick("Change")

This information also applies to WOptionSelect(). Use WOptionClick

to generate a Click event for the indicated option button in the same

manner as the above example.

Additional reference words: 1.00