tank you , just was i needed
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 172, 53, 313, 377)
$Start = GUICtrlCreateButton("Start", 8, 16, 75, 25, $WS_GROUP)
$Stop = GUICtrlCreateButton("Stop", 88, 16, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start
AdlibRegister ("Test1")
Case $Stop
AdlibUnRegister ("Test1")
Exit
EndSwitch
WEnd
Func Test1()
RegWrite ("HKEY_CURRENT_USER\Software\MyApplication", "testkey", "REG_SZ", "im a value")
EndFunc