Heyho, hab wieder ein Problem.
Ich habe ein Hauptfenster und möchte mit einem Button ein Impressum öffnen, dass funktioniert auch, doch wenn ich das Impressum mit dem X schließe dann schließt sich auch das Hauptfenster. Der Schliessen Button im Impressum funkt auch nicht kann mir da jemand helfen?Und gibt es vielleicht eine Möglichkeit das Hauptfenster zu sperren wenn das Impressum geöffnet ist?
Edit: Das X habe ich jetzt auch deaktiviert.
Spoiler anzeigen
AutoIt
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=Video Converter only .avi to .mp4.
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <File.au3>
Ordner ()
Func Ordner ()
Local $VideoConverter = @TempDir&"\Video_Converter"
DirCreate ($VideoConverter)
EndFunc
$widthCell=300
Global $sFileOpenDialog
Global $sFileSelectFolder
Global $iDelete
ChooseButton()
Func ChooseButton()
Const $SC_CLOSE = 0xF060
Const $MF_BYCOMMAND = 0x0
Const $MF_GRAYED = 0x1
; Create a GUI with various controls.
Local $hGUI = GUICreate("Video Converter", 430, 200, 750, 430)
GUIRegisterMsg($WM_SYSCOMMAND, "")
$hMenu = DllCall("user32.dll", "hwnd", "GetSystemMenu", "hwnd", $hGUI, "int", 0)
DllCall("user32.dll", "hwnd", "EnableMenuItem", "hwnd", $hMenu[0], "int", $SC_CLOSE, "int", BitOR($MF_BYCOMMAND, $MF_GRAYED))
; Create a button control.
GUICtrlCreateLabel ("Bitte Datei auswählen: ", 20, 20, $widthCell)
GUICtrlCreateLabel ("Bitte Ablageort für konvertierte Datei auswählen: ", 20, 80, $widthCell)
Global $impressum = GUICtrlCreateButton ("Impressum", 30, 150, 80, 20)
Global $convert = GUICtrlCreateButton ("Konvertieren", 315, 150, 85, 20)
Local $chooseda = GUICtrlCreateButton("Quelle", 330, 40, 60, 20)
Local $chooseor = GUICtrlCreateButton("Ziel", 330, 100, 60, 20)
Local $idClose = GUICtrlCreateButton("Schließen", 170, 150, 85, 20)
;Set the GUI background color
GUISetBkColor(0x826D50)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
Local $iPID = 0
Local $iPID1= 0
Local $iPID2= 0
Local $iPID3= 0
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idClose
ExitLoop
Case $chooseda
$iPID = _openVideoFile()
Global $datei = GUICtrlCreateInput ( $sFileOpenDialog, 20, 40, 300,20)
Case $chooseor
$iPID1 = _FileSelectFolder()
Global $ort = GuiCtrlCreateInput ( $sFileSelectFolder, 20, 100, 300, 20)
Case $convert
$iPID2 = Convert ()
Case $impressum
$iPID3 = Impressum ()
EndSwitch
WEnd
GUIDelete($hGUI)
; Close the Exlporer process using the PID returned by Run.
If $iPID1 Then ProcessClose($iPID1)
EndFunc
idClose()
Func idclose()
FileDelete(@TempDir&"\Video_Converter")
EndFunc
;openVideoFile ()
Func _openVideoFile()
; Create a constant variable in Local scope of the message to display in FileOpenDialog.
Local Const $sMessage = "Wähle Datei"
; Display an open dialog to select a list of file(s).
$sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Videos (*.avi)", $FD_FILEMUSTEXIST + $FD_MULTISELECT)
If @error Then
MsgBox(4144,"Fehlermeldung", "Keine Datei gewählt!")
; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.
FileChangeDir(@ScriptDir)
Else
; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.
FileChangeDir(@ScriptDir)
EndIf
EndFunc
;FileSelectFolder ()
Func _FileSelectFolder()
Global $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
$sFileSelectFolder = FileSaveDialog("Wähle Ordner", $MyDocsFolder, "Video (*.mp4)", 2)
If @error Then
MsgBox(4144,"Fehlermeldung", "Kein Ziel gewählt!")
EndIf
EndFunc
;Convert ()
Func Convert ()
Global $msg
If $sFileOpenDialog = "" Then
MsgBox(4144,"Fehlermeldung","Keine Datei gewählt!")
ElseIf $sFileSelectFolder = "" Then
MsgBox(4144,"Fehlermeldung", "Kein Ziel gewählt!")
Else
Run( @TempDir&"\Video_Converter\ffmpeg.exe -i """ &$sFileOpenDialog& """ -vcodec libx264 """ &$sFileSelectFolder& """")
$msg = GUIGetMsg()
GUICtrlDelete($datei)
GUICtrlDelete($ort)
EndIf
EndFunc
;Impressum ()
Func Impressum()
Const $SC_CLOSE = 0xF060
Const $MF_BYCOMMAND = 0x0
Const $MF_GRAYED = 0x1
Local $hGUI1 = GUICreate ("Impressum", 250, 300)
GUIRegisterMsg($WM_SYSCOMMAND, "")
$hMenu = DllCall("user32.dll", "hwnd", "GetSystemMenu", "hwnd", $hGUI1, "int", 0)
DllCall("user32.dll", "hwnd", "EnableMenuItem", "hwnd", $hMenu[0], "int", $SC_CLOSE, "int", BitOR($MF_BYCOMMAND, $MF_GRAYED))
GUICtrlCreateLabel ("Entwickler: " &@CRLF& "fg" &@CRLF& "Mfg", 20, 40, $widthCell)
GUICtrlCreateLabel ("Icon: " &@CRLF& "fg" , 20, 130, $widthCell)
GUICtrlCreateLabel ("Version: 1.0.3.0", 20, 210, $widthCell)
Local $idClose1 = GUICtrlCreateButton("Schließen", 20, 250, 85, 20)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idClose1
EndSwitch
GUISetBkColor(0x826D50)
GUISetState(@SW_SHOW, $hGUI1)
EndFunc
Alles anzeigen