#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
GUICreate('Test', 200, 100)
$i_CheckBox = GUICtrlCreateCheckbox('Test Checkbox', 40, 10, 120, 20)
$i_Button = GUICtrlCreateButton('Click me', 40, 50, 120, 30)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $i_Button
GUICtrlSendMsg($i_CheckBox, $BM_SETCHECK, Not GUICtrlSendMsg($i_CheckBox, $BM_GETCHECK, 0, 0), 0)
EndSwitch
WEnd