| 1 | #include <Date.au3> |
|---|
| 2 | #include <array.au3> |
|---|
| 3 | ;#include <string.au3> |
|---|
| 4 | ;#include <File.au3> |
|---|
| 5 | |
|---|
| 6 | #include <MsgBoxConstants.au3> |
|---|
| 7 | #include <GUIConstantsEx.au3> |
|---|
| 8 | #include <GuiEdit.au3> |
|---|
| 9 | #include <WindowsConstants.au3> |
|---|
| 10 | #include <EditConstants.au3> |
|---|
| 11 | #include <GuiButton.au3> |
|---|
| 12 | #include <ScrollBarsConstants.au3> |
|---|
| 13 | #include <WinAPIFiles.au3> |
|---|
| 14 | #include <ProgressConstants.au3> |
|---|
| 15 | #include <FileConstants.au3> |
|---|
| 16 | #include <StaticConstants.au3> |
|---|
| 17 | #include <ButtonConstants.au3> |
|---|
| 18 | #include <GuiRichEdit.au3> |
|---|
| 19 | |
|---|
| 20 | $Interrupt = 0 |
|---|
| 21 | Opt("GUIOnEventMode", 1) |
|---|
| 22 | $Form1 = GUICreate("Automatischer File Copy", 470, 665) |
|---|
| 23 | $iOKB = GUICtrlCreateButton("Sart", 10, 10, 50, 20, $BS_BITMAP) |
|---|
| 24 | GUICtrlSetOnEvent(-1, "StartFunc") |
|---|
| 25 | $iStop = GUICtrlCreateButton("Stop", 70, 10, 50, 20) |
|---|
| 26 | GUICtrlSetOnEvent(-1, "StopFunc") |
|---|
| 27 | $ExitID = GUICtrlCreateButton("Exit", 130, 10, 50, 20) |
|---|
| 28 | GUICtrlSetOnEvent(-1, "_exit") |
|---|
| 29 | $iBCE = GUICtrlCreateRadio("Edit", 190, 4, 150, 20) |
|---|
| 30 | $iBRE = GUICtrlCreateRadio("RichEdit", 190, 22, 150, 20) |
|---|
| 31 | GUICtrlSetState($iBCE, $GUI_CHECKED) |
|---|
| 32 | GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") |
|---|
| 33 | GUISetState() |
|---|
| 34 | GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") |
|---|
| 35 | GUICtrlCreateLabel("GUICtrlCreateEdit:", 10, 40, 100, 15) |
|---|
| 36 | GUICtrlCreateLabel("GUICtrlRichEdit:", 240, 40, 100, 15) |
|---|
| 37 | |
|---|
| 38 | $LogWindowE = GUICtrlCreateEdit("", 10, 60, 220, 580, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_AUTOHSCROLL + $WS_HSCROLL + $ES_READONLY) |
|---|
| 39 | GUICtrlSetBkColor(-1,0xFFFFFF) |
|---|
| 40 | GUICtrlSetFont(-1, 8.5, 400, 0, "MS Sans Serif") |
|---|
| 41 | GUICtrlSetLimit(-1,0x7FFFFFFF) |
|---|
| 42 | $LogWindowR = _GUICtrlRichEdit_Create($Form1, "", 240, 60, 220, 580, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL, $ES_AUTOHSCROLL, $ES_READONLY)) |
|---|
| 43 | |
|---|
| 44 | While 1 |
|---|
| 45 | Sleep(10) |
|---|
| 46 | Wend |
|---|
| 47 | |
|---|
| 48 | Func StartFunc() |
|---|
| 49 | $Interrupt = 0 |
|---|
| 50 | For $counter = 1 To 1000 |
|---|
| 51 | If $Interrupt <> 0 Then Return |
|---|
| 52 | Select |
|---|
| 53 | Case BitAND(GUICtrlRead($iBCE), $GUI_CHECKED); Same |
|---|
| 54 | _mylogE("Counter is: " & $counter & @CRLF) |
|---|
| 55 | Case BitAND(GUICtrlRead($iBRE), $GUI_CHECKED); Same |
|---|
| 56 | _mylogR("Counter is: " & $counter & @CRLF) |
|---|
| 57 | EndSelect |
|---|
| 58 | Next |
|---|
| 59 | |
|---|
| 60 | EndFunc |
|---|
| 61 | |
|---|
| 62 | Func StopFunc() |
|---|
| 63 | Select |
|---|
| 64 | Case BitAND(GUICtrlRead($iBCE), $GUI_CHECKED); Same |
|---|
| 65 | _mylogE("Stopped" & @CRLF) |
|---|
| 66 | Case BitAND(GUICtrlRead($iBRE), $GUI_CHECKED); Same |
|---|
| 67 | _mylogR("Stopped" & @CRLF) |
|---|
| 68 | EndSelect |
|---|
| 69 | EndFunc |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | Func _myLogR($logtext, $color = "0x000000") |
|---|
| 74 | $iEndPoint = _GUICtrlRichEdit_GetTextLength($LogWindowR, True, True) - _GUICtrlRichEdit_GetLineCount($LogWindowR) |
|---|
| 75 | If $iEndPoint < 0 Then $iEndPoint = 0 |
|---|
| 76 | _GUICtrlRichEdit_AppendText($LogWindowR, $logtext) |
|---|
| 77 | ;_GuiCtrlRichEdit_SetSel($LogWindowR, $iEndPoint, -1) |
|---|
| 78 | ;_GuiCtrlRichEdit_SetCharColor($LogwindowR, $color) |
|---|
| 79 | ;_GUICtrlRichEdit_Deselect($LogWindowR) |
|---|
| 80 | EndFunc |
|---|
| 81 | |
|---|
| 82 | Func _mylogE($logtext) |
|---|
| 83 | $bEnd = StringLen(GUICtrlRead($LogWindowE)) |
|---|
| 84 | _GUICtrlEdit_SetSel($LogWindowE, $bEnd, $bEnd) |
|---|
| 85 | _GUICtrlEdit_Scroll($LogWindowE, $SB_SCROLLCARET) |
|---|
| 86 | GUICtrlSetData($LogWindowE, $logtext, 1) |
|---|
| 87 | EndFunc |
|---|
| 88 | |
|---|
| 89 | Func _exit() |
|---|
| 90 | Exit |
|---|
| 91 | EndFunc |
|---|
| 92 | |
|---|
| 93 | Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) |
|---|
| 94 | If BitAND($wParam, 0x0000FFFF) = $iStop Then $Interrupt = 1 |
|---|
| 95 | Return $GUI_RUNDEFMSG |
|---|
| 96 | EndFunc |
|---|