#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
GUICreate("Bas editor",500,500)
Local $edit = GUICtrlCreateEdit("print " & """hello""" & @CRLF & "while 1"& @CRLF & "wend", 0, 0, 450, 450)
Local $rootmenu = GUICtrlCreateMenu("COMMANDS")
Local $subrootmenu1 = GUICtrlCreateMenuItem("COMPILE", $rootmenu)
Local $subrootmenu2 = GUICtrlCreateMenuItem("RUN", $rootmenu)
Local $subrootmenu3 = GUICtrlCreateMenuItem("EXIT", $rootmenu)
GUICtrlSetFont($edit,20)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE then Exit
if $msg = $subrootmenu1 then
Local $code = GUICtrlRead($edit)
Local $hFileOpen = FileOpen("program.bas", $FO_OVERWRITE)
$hFileOpen = FileOpen("program.bas", $FO_APPEND)
FileWrite("program.bas",$code)
Run("C:\Program Files\FreeBASIC\fbc program.bas")
EndIf
if $msg = $subrootmenu2 then
Run("program.exe",@DesktopDir)
EndIf
if $msg = $subrootmenu3 then
Exit
EndIf
WEnd
|