#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $iMultiplikator = 0

$Form1 = GUICreate("DummyFile", 203, 107, 192, 124)
$Group1 = GUICtrlCreateGroup("Dateigröße", 8, 8, 185, 57)
$Input1 = GUICtrlCreateInput("1", 24, 32, 105, 21, $ES_NUMBER)
$Combo1 = GUICtrlCreateCombo("", 136, 32, 49, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "KiB|MiB|GiB")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Datei Erstellen", 56, 72, 83, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Combo1
			Switch GUICtrlRead($Combo1)
				Case "KiB"
					$iMultiplikator = (1024)
				Case "MiB"
					$iMultiplikator = (1024 * 1024)
				Case "GiB"
					$iMultiplikator = (1024 * 1024 * 1024)
			EndSwitch
		Case $Button1
			$iFilesize = GUICtrlRead($Input1)
			If $iFilesize = "" Then
				MsgBox(48, "DummyFile", "Bitte eine Größe eingeben!")
				ContinueLoop
			Else
				$iFilesize *= $iMultiplikator
				$sFilepath = FileSaveDialog("Dateispeicherort Wählen!", "", "Alle Dateien (*.*)")
				If $sFilepath <> "" And (Not @error) Then
					If FileExists($sFilepath) = 1 Then
						MsgBox(48, "DummyFile", "Datei existiert Bereits!")
					Else
						ProgressOn("DummyFile", "Datei wird Erstellt!")
						RunWait(@ComSpec & ' /c fsutil file createnew "' & $sFilepath & '" ' & $iFilesize, "", @SW_HIDE)
						ProgressSet(100)
						ProgressOff()
						MsgBox(64, "DummyFile", "Datei Erstellt!")
					EndIf
				Else
					MsgBox(16, "DummyFile", "Kein Dateipfad Gewählt!")
				EndIf
			EndIf
	EndSwitch
WEnd