Sprenger120

Idle Box

May 11th, 2011
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.42 KB | None | 0 0
  1. #include <WindowsConstants.au3>
  2. #include <EditConstants.au3>
  3.  
  4. IdleBox("Idle Box by Sprenger120" & @CRLF & "vorgänge die etwas dauern kann man hiermit überbrücken ^^")
  5. Sleep(10000)
  6. IdleBox("",False)
  7.  
  8. Func IdleBox($sText, $fExit = False)
  9.     Local Static $hGUI_IdleBox
  10.     Local Const $iMaxLineLenght = 50
  11.     Local $iStringLen, $iLineCount = 1, $iLineLenght = $iMaxLineLenght
  12.     Local $iWidth, $iHeight, $iStart = 1, $iLastFound
  13.     ;By Sprenger120
  14.     Switch $fExit
  15.         Case False
  16.             $iStringLen = StringLen($sText)
  17.  
  18.             ;Alle CRLF's suchen
  19.             While 1
  20.                 $iLastFound = StringInStr($sText, @CRLF, 1, $iLineCount, $iStart)
  21.                 If $iLastFound = 0 Then ExitLoop
  22.                 $iStart = $iLastFound
  23.                 $iLineCount += 1
  24.             WEnd
  25.             $iLineCount -= 1
  26.  
  27.             ;benötige zeilenanzahl ermitteln
  28.             $iLineCount += Int($iStringLen / $iMaxLineLenght)
  29.             If Mod($iStringLen, $iMaxLineLenght) Then $iLineCount += 1 ; den "überhang" mit dazuzählen
  30.  
  31.             If $iStringLen < $iMaxLineLenght Then $iLineLenght = $iStringLen
  32.  
  33.             ;GUI Größe
  34.             $iWidth = $iLineLenght * 5
  35.             $iHeight = $iLineCount * 15
  36.  
  37.             $hGUI_IdleBox = GUICreate("", $iWidth, $iHeight, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST);, $hGUI_Main)
  38.             GUISetBkColor(0xFFFFFF)
  39.             GUICtrlCreateLabel($sText, 1, 1, $iWidth, $iHeight, 0)
  40.             GUICtrlSetBkColor(-1, 0xFFFFFF)
  41.  
  42.             GUISetState(@SW_SHOW, $hGUI_IdleBox)
  43.         Case True
  44.             GUIDelete($hGUI_IdleBox)
  45.     EndSwitch
  46. EndFunc   ;==>IdleBox
Advertisement
Add Comment
Please, Sign In to add comment