Hallo zusammen,
die Funktion "MsgBox" erfüllt sicher ihren Zweck. Ich denke meist zu Fehlersuche. In einer Anwendung ist sie doch sehr begrenzt.
So hab ich mir in den letzten Tagen eine "_MsgBox"-Funktion als einzelnes Modul entwickelt. Die läuft auch super ... mit Sound und Grafik und großer Schrift (Die Anwender stehen nicht direkt am PC)...
_MsgBox im Modul
;
;
; MsgBox - De Rand Ere
;
;
;
#include-once
#include <Sound.au3>
#include <ButtonConstants.au3>
#include <ColorConstants.au3>
#include <FontConstants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIHObj.au3>
Global $aSounds[5], $vEAN = "1234567891234567", $vName = "Schulzendorf"
Global $idMsgOk, $idMsgBeenden
$aSounds[0] = _SoundOpen(@ScriptDir&"\atx\Sound_Button.mp3") ; Button
$aSounds[1] = _SoundOpen(@ScriptDir&"\atx\Sound_Fehler.mp3") ;Fehler
$aSounds[2] = _SoundOpen(@ScriptDir&"\atx\Sound_Frage.mp3") ; weiter
$aSounds[3] = _SoundOpen(@ScriptDir&"\atx\Sound_Info.mp3") ; Ifo
global $idBeenden, $tZeit, $idVerstande
$vWert = _msgBox("Frage",_msg_Bild(4),_Msg_UETxt(2),_Msg_TxT(2),_Msg_OK(2),_Msg_No(2),_msg_Sound("Frage"))
;ID: 1= Fehler, 2 = Frage, 3 = Info
;Bild: 1= Fehler, 2 = Frage, 3 = Info, 4 = Exit
ConsoleWrite("EndeWert: "&$vWert&@LF)
; -----------------------------------------------------------------------------------------
Func _msgBox($ID,$vPic,$vUETxt,$vMsgTxt,$Ok_Txt,$No_Txt,$vSound)
$tZeit = TimerInit()
$hMsgBox = GUICreate("",800,340,-1,-1,$WS_POPUPWINDOW,$WS_EX_CLIENTEDGE+$WS_EX_DLGMODALFRAME)
Switch $ID
Case "Fehler" ; Fehler
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0xff0000)
GUICtrlCreateLabel("Fehler:",20, 20, 110, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0xff0000)
GUICtrlCreateLabel($vUETxt,130, 20, 650, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0xff0000)
_SoundPlay($vSound)
Case "Frage" ; Frage
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0x069395)
GUICtrlCreateLabel("Frage:",20, 20, 110, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0x069395)
GUICtrlCreateLabel($vUETxt,130, 20, 650, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0x069395)
_SoundPlay($vSound)
Case "Info" ; Info
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0x10EB0B)
GUICtrlCreateLabel("Information:",20, 20, 190, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetBkColor(-1,0x10EB0B)
GUICtrlCreateLabel($vUETxt,215, 20, 585, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetBkColor(-1,0x10EB0B)
_SoundPlay($vSound)
EndSwitch
_GUICtrlPic_Create($vPic,20,120,120,120)
; Info Text Bereich
GUICtrlCreateGraphic(150,90,617,170,$SS_ETCHEDFRAME)
GUICtrlSetBkColor(-1,0xFFEE99)
GUICtrlCreateLabel($vMsgTxt,170,110, 595,140)
GUICtrlSetFont(-1,15, $FW_MEDIUM ,0)
GUICtrlSetBkColor(-1,0xFFEE99)
; Fußzeile
$idMsgBeenden = GUICtrlCreateButton($No_Txt, 30 , 290, 180, 40)
GUICtrlSetFont(-1,10, $FW_MEDIUM ,0)
$idMsgOk = GUICtrlCreateButton($Ok_Txt, 320 , 270, 450, 60)
GUICtrlSetFont(-1,20, $FW_BOLD ,0)
GUICtrlSetState(-1,$GUI_FOCUS)
GUISetBkColor(0xFFCC01, $hMsgBox) ; Postgelb
GUISetState(@SW_SHOW, $hMsgBox)
while 1
Switch GUIGetMsg()
Case $idMsgOk
;~ Return(1)
ExitLoop
Case $GUI_EVENT_CLOSE, $idMsgBeenden
;~ Return(7)
ExitLoop
EndSwitch
If TimerDiff($tZeit) > 15000 And TimerDiff($tZeit) > 15500 Then
_SoundPlay($vSound)
$tZeit = TimerInit()
EndIf
WEnd
EndFunc
Func _Msg_UETxt($Nr) ; Überschrift der MsgBox
Switch $Nr
Case 1
$vTxt = "Zulauf Paket: Eingabe 'EAN'!"
Case 2
$vTxt = "Programm beenden ?"
Case 3
$vTxt = "Prüfung Paket-Rücksendung!"
Case 4
$vTxt = "Zulauf Paket: Eingabe 'Name'!"
Case 5
$vTxt = "Zulauf Paket: Eingabe 'Lagerfach'!"
Case 6
$vTxt = "Zulauf Paket: Eingabe 'Lagerfach'!"
Case 7
$vTxt = "Paketsuche ohne Erfolg!"
Case 8
$vTxt = "Paketsuche ohne Erfolg!"
Case 9
$vTxt = "Paketausgabe!"
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_TxT($Nr) ; Text der MsgBox
Switch $Nr
Case 1
$vTxt = "Die Länge des EAN - Codes stimmt nicht! Es müssen 16 Ziffern sein!"&@LF&@LF
$vTxt &= "Bitte überprüfe Deine Eingabe!"
Case 2
$vTxt = "Soll das Programm beendet werden?"&@LF&@LF
$vTxt &= "Die aktuellen Daten werden gespeichert."
Case 3
$vTxt = "Der Lagerbestand würde auf fällige Rücksendungen überprüft!"&@LF&@LF
$vTxt &= "Bitte kontrolliere den Drucker auf die Rücksendeliste!"
Case 4
$vTxt = "Der Name des Paketempfängers ist nicht eingetragen!"&@LF&@LF
$vTxt &= "Bitte prüfe Deine Eingabe"
Case 5
$vTxt = "Die Anzahl der Ziffern zum Lagerfach ist nicht richtig!"&@LF&@LF
$vTxt &= "Es müssen zwei Ziffern sein. Bitte prüfe Deine Eingabe"
Case 6
$vTxt = "Das eingegebene Lagerfach ist nicht verfügbar!"&@LF&@LF
$vTxt &= 'Siehe "Information zu den Lagerflächen" im Zulauffenster.'&@LF
$vTxt &= 'Bitte prüfe Deine Eingabe.'
Case 7
$vTxt = "Das Paket mit dem EAN - Code "&$vEAN&" ist nicht vorhanden!"&@LF&@LF
$vTxt &= "Das Paket ist entweder noch nicht eingetroffen oder die Lagerzeit war überschritten."
Case 8
$vTxt = "Das Paket mit dem Adressat "&$vName&" ist nicht vorhanden!"&@LF&@LF
$vTxt &= "Das Paket ist entweder noch nicht eingetroffen oder die Lagerzeit war überschritten."
Case 9
$vTxt = "Soll das Paket"&@LF
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_Ok($Nr)
Switch $Nr
Case 1
$vTxt = "Zurück zum EAN-Code"
Case 2
$vTxt = "OK - Programmende"
Case 3
$vTxt = "OK und Zurück"
Case 4
$vTxt = 'Zurück zur Eingabe "Name"'
Case 5
$vTxt = 'Zurück zur Eingabe "Lagerfach"'
Case 6
$vTxt = 'Zurück zur Eingabe "Lagerfach"'
Case 7
$vTxt = 'Zurück zur Suche "EAN - Code"'
Case 8
$vTxt = 'Zurück zur Suche "Name"'
Case 9
$vTxt = 'Ja, Paket austragen'
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_No($Nr)
Switch $Nr
Case 1
$vTxt = "Beenden (ESC)"
Case 2
$vTxt = "Nein, zurück"
EndSwitch
Return($vTxt)
EndFunc
Func _msg_Bild($Nr)
Switch $Nr
Case 1 ; Fehler
$vTxt = @ScriptDir&"\gfx\Achtung_1.png"
Case 2 ; Frage
$vTxt = @ScriptDir&"\gfx\Fragezeichen.png"
Case 3 ; Info
$vTxt = @ScriptDir&"\gfx\Info.png"
Case 4 ; Exit
$vTxt = @ScriptDir&"\gfx\Exit.png"
EndSwitch
Return($vTxt)
EndFunc
Func _msg_Sound($Nr)
Switch $Nr
Case "Fehler" ; Fehler
$vTxT = $aSounds[1]
Case "Frage"
$vTxT = $aSounds[2]
Case "Info"
$vTxT = $aSounds[3]
EndSwitch
Return($vTxt)
EndFunc
; #INTERNAL_USE_ONLY#=================================================================================================
; Name...........: _GUICtrlPic_Create
; Description ...: Creates a Picture control for the GUI
; Syntax ........: _GUICtrlPic_Create($sFilename, $iLeft, $iTop, $iWidth, $iHeight, $iStyle = -1 , $iExStyle = -1)
; Parameters ....: $sFilename - Path of image file
; Author ........: UEZ
; Modified.......: Melba23, guinness, jpm
; Remarks .......: PNG image can be used.
; ====================================================================================================================
Func _GUICtrlPic_Create($sFilename, $iLeft, $iTop, $iWidth = -1, $iHeight = -1, $iStyle = -1, $iExStyle = -1)
_GDIPlus_Startup()
Local $idPic = GUICtrlCreatePic("", $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFilename)
If $iWidth = -1 Then $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
If $iHeight = -1 Then $iHeight = _GDIPlus_ImageGetHeight($hBitmap)
Local $hBitmap_Resized = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Local $hBMP_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Resized)
_GDIPlus_GraphicsSetInterpolationMode($hBMP_Ctxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC)
_GDIPlus_GraphicsDrawImageRect($hBMP_Ctxt, $hBitmap, 0, 0, $iWidth, $iHeight)
Local $hHBitmap = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap_Resized)
Local $hPrevImage = GUICtrlSendMsg($idPic, $STM_SETIMAGE, 0, $hHBitmap) ; $STM_SETIMAGE = 0x0172
_WinAPI_DeleteObject($hPrevImage); Delete Prev image if any
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBitmap_Resized)
_GDIPlus_GraphicsDispose($hBMP_Ctxt)
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
Return $idPic
EndFunc ;==>_GUICtrlPic_Create
Alles anzeigen
So richtig toll ist das erst mir Grafik und Sound. Lade ich mit hoch als zip. Einfach in einem Unterverzeichnis dezipn ... Das ist die Rohfassung ohne Fehlerbearbeitung ... __MsgBox.zip
Nun war mein Plan die "_MsgBox" mit seinen Anhängen in mein Projekt zu übernehmen und Stück für Stück die "MsgBox"-Anweisungen umzustellen.
Alter Arsch - nix geht los
Ich will also das Hauptfenster "liegen lasse" und mein Msg-Fenster drüber legen. Das Msg-Fenster ohne Rahmen und Kopf. Zwei Button (Ja / Nein) ... und dann solls im Programm weitergehen ...
Ich hab das mal rausgezogen:
Spoiler anzeigen
#include-once
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ColorConstants.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <FontConstants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiListViewEx.au3>
#include <IE.au3>
#include <ListViewColorsFonts.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <Sound.au3>
#include <StringConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIHObj.au3>
#include <WinAPIIcons.au3>
#include <WinAPIInternals.au3>
#include <WinAPISysInternals.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
Global $hMsgBox, $idMsgNo, $idMsgOK, $vSound ; GUI für Systemmeldungen
Global $tZeitmsg
;~ ---------- Definitionen - HauptFenster -----------------
$vGUIBreite = 1366
$vGUIHoehe = 700
$hGui = GUICreate("Paketverwaltung DHL-Filiale - Lagerung, Suche und Rücksendung",$vGUIBreite,$vGUIHoehe)
$idBeenden = GUICtrlCreateButton("Beenden (ESC)", $vGUIBreite - 200 , $vGUIHoehe - 80, 180, 40)
GUICtrlSetFont(-1,15, $FW_BOLD ,0)
GUISetState(@SW_SHOW, $hGui)
While 1
$aInfo = GUIGetMsg(1)
Switch $aInfo[1]
Case $hGui
Switch $aInfo[0]
Case $GUI_EVENT_CLOSE, $idBeenden
;~ $vAbfrage = MsgBox(289,"Progarmmende", "Program beenden?")
$vAbfrage = _msgBox("Frage",_msg_Bild(4),_Msg_UETxt(2),_Msg_TxT(2),_Msg_OK(2),_Msg_No(2),_msg_Sound("Frage"))
ConsoleWrite("Abfragewert: "&$vAbfrage&@LF)
If $vAbfrage = 1 Then
ExitLoop
EndIf
EndSwitch
Case $hMsgBox
Switch $aInfo[0]
Case $idMsgNo
ConsoleWrite("Button $idMsgBeenden"&@LF)
Case $idMsgOk
ConsoleWrite("Button MsgOK"&@LF)
EndSwitch
If TimerDiff($tZeitmsg) > 15000 And TimerDiff($tZeitmsg) > 15100 Then ; Wiederholt den Sound nach 15 sec bei Inaktivität (Keine Bestätigung)
_SoundPlay($vSound)
$tZeitmsg = TimerInit()
EndIf
EndSwitch
WEnd
;------------------- Funktionen -----------------------------------------------------------------------------------
Func _msgBox($ID,$vPic,$vUETxt,$vMsgTxt,$Ok_Txt,$No_Txt,$vSound)
$tZeitmsg = TimerInit()
$hMsgBox = GUICreate("",800,340,-1,-1,$WS_POPUPWINDOW,$WS_EX_CLIENTEDGE+$WS_EX_DLGMODALFRAME)
Switch $ID
Case "Fehler" ; Fehler
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0xff0000)
GUICtrlCreateLabel("Fehler:",20, 20, 110, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0xff0000)
GUICtrlCreateLabel($vUETxt,130, 20, 650, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
;~ GUICtrlSetColor(-1,0x5d0643)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0xff0000)
_SoundPlay($vSound)
Case "Frage" ; Frage
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0x069395)
GUICtrlCreateLabel("Frage:",20, 20, 110, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0x069395)
GUICtrlCreateLabel($vUETxt,130, 20, 650, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetColor(-1,$COLOR_WHITE)
GUICtrlSetBkColor(-1,0x069395)
_SoundPlay($vSound)
Case "Info" ; Info
GUICtrlCreateGraphic(0,13,800,55)
GUICtrlSetBkColor(-1,0x10EB0B)
GUICtrlCreateLabel("Information:",20, 20, 190, 38) ; Kategorie
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetBkColor(-1,0x10EB0B)
GUICtrlCreateLabel($vUETxt,215, 20, 585, 38,$SS_CENTER) ; Bereich
GUICtrlSetFont(-1,25, $FW_BOLD ,0)
GUICtrlSetBkColor(-1,0x10EB0B)
_SoundPlay($vSound)
EndSwitch
_GUICtrlPic_Create($vPic,20,120,120,120)
; Info Text Bereich
GUICtrlCreateGraphic(150,90,617,170,$SS_ETCHEDFRAME)
GUICtrlSetBkColor(-1,0xFFEE99)
GUICtrlCreateLabel($vMsgTxt,170,110, 595,140)
GUICtrlSetFont(-1,15, $FW_MEDIUM ,0)
GUICtrlSetBkColor(-1,0xFFEE99)
; Fußzeile
$idMsgNo = GUICtrlCreateButton($No_Txt, 30 , 290, 180, 40)
GUICtrlSetFont(-1,10, $FW_MEDIUM ,0)
$idMsgOk = GUICtrlCreateButton($Ok_Txt, 320 , 270, 450, 60)
GUICtrlSetFont(-1,20, $FW_BOLD ,0)
GUICtrlSetState(-1,$GUI_FOCUS)
GUISetBkColor(0xFFCC01, $hMsgBox) ; Postgelb
EndFunc
Func _Msg_UETxt($Nr) ; Überschrift der MsgBox
Switch $Nr
Case 1
$vTxt = "Zulauf Paket: Eingabe 'EAN'!"
Case 2
$vTxt = "Programm beenden ?"
Case 3
$vTxt = "Prüfung Paket-Rücksendung!"
Case 4
$vTxt = "Zulauf Paket: Eingabe 'Name'!"
Case 5
$vTxt = "Zulauf Paket: Eingabe 'Lagerfach'!"
Case 6
$vTxt = "Zulauf Paket: Eingabe 'Lagerfach'!"
Case 7
$vTxt = "Paketsuche ohne Erfolg!"
Case 8
$vTxt = "Paketsuche ohne Erfolg!"
Case 9
$vTxt = "Paketausgabe!"
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_TxT($Nr) ; Text der MsgBox
Switch $Nr
Case 1
$vTxt = "Die Länge des EAN - Codes stimmt nicht! Es müssen 16 Ziffern sein!"&@LF&@LF
$vTxt &= "Bitte überprüfe Deine Eingabe!"
Case 2
$vTxt = "Soll das Programm beendet werden?"&@LF&@LF
$vTxt &= "Die aktuellen Daten werden gespeichert."
Case 3
$vTxt = "Der Lagerbestand würde auf fällige Rücksendungen überprüft!"&@LF&@LF
$vTxt &= "Bitte kontrolliere den Drucker auf die Rücksendeliste!"
Case 4
$vTxt = "Der Name des Paketempfängers ist nicht eingetragen!"&@LF&@LF
$vTxt &= "Bitte prüfe Deine Eingabe"
Case 5
$vTxt = "Die Anzahl der Ziffern zum Lagerfach ist nicht richtig!"&@LF&@LF
$vTxt &= "Es müssen zwei Ziffern sein. Bitte prüfe Deine Eingabe"
Case 6
$vTxt = "Das eingegebene Lagerfach ist nicht verfügbar!"&@LF&@LF
$vTxt &= 'Siehe "Information zu den Lagerflächen" im Zulauffenster.'&@LF
$vTxt &= 'Bitte prüfe Deine Eingabe.'
Case 7
$vTxt = "Das Paket mit dem EAN - Code ist nicht vorhanden!"&@LF&@LF
$vTxt &= "Das Paket ist entweder noch nicht eingetroffen oder die Lagerzeit war überschritten."
Case 8
$vTxt = "Das Paket mit dem Adressat ist nicht vorhanden!"&@LF&@LF
$vTxt &= "Das Paket ist entweder noch nicht eingetroffen oder die Lagerzeit war überschritten."
Case 9
$vTxt = "Soll das Paket"&@LF
$vTxt &= "EAN - Code: xyz"&@LF
$vTxt &= "Name: Hans Irgenswas ausgetragen werden?"
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_Ok($Nr)
Switch $Nr
Case 1
$vTxt = "Zurück zum EAN-Code"
Case 2
$vTxt = "OK - Programmende"
Case 3
$vTxt = "OK und Zurück"
Case 4
$vTxt = 'Zurück zur Eingabe "Name"'
Case 5
$vTxt = 'Zurück zur Eingabe "Lagerfach"'
Case 6
$vTxt = 'Zurück zur Eingabe "Lagerfach"'
Case 7
$vTxt = 'Zurück zur Suche "EAN - Code"'
Case 8
$vTxt = 'Zurück zur Suche "Name"'
Case 9
$vTxt = 'Ja, Paket austragen'
EndSwitch
Return($vTxt)
EndFunc
Func _Msg_No($Nr)
Switch $Nr
Case 1
$vTxt = "Beenden (ESC)"
Case 2
$vTxt = "Nein, zurück"
EndSwitch
Return($vTxt)
EndFunc
Func _msg_Bild($Nr)
Switch $Nr
Case 1 ; Fehler
$vTxt = @ScriptDir&"\gfx\Achtung_1.png"
Case 2 ; Frage
$vTxt = @ScriptDir&"\gfx\Fragezeichen.png"
Case 3 ; Info
$vTxt = @ScriptDir&"\gfx\Info.png"
Case 4 ; Exit
$vTxt = @ScriptDir&"\gfx\Exit.png"
EndSwitch
Return($vTxt)
EndFunc
Func _msg_Sound($Nr)
Switch $Nr
Case "Fehler" ; Fehler
;~ $vTxT = $aSounds[1]
Case "Frage"
;~ $vTxT = $aSounds[2]
Case "Info"
;~ $vTxT = $aSounds[3]
EndSwitch
;~ Return($vTxt)
EndFunc
; #INTERNAL_USE_ONLY#=================================================================================================
; Name...........: _GUICtrlPic_Create
; Description ...: Creates a Picture control for the GUI
; Syntax ........: _GUICtrlPic_Create($sFilename, $iLeft, $iTop, $iWidth, $iHeight, $iStyle = -1 , $iExStyle = -1)
; Parameters ....: $sFilename - Path of image file
; Author ........: UEZ
; Modified.......: Melba23, guinness, jpm
; Remarks .......: PNG image can be used.
; ====================================================================================================================
Func _GUICtrlPic_Create($sFilename, $iLeft, $iTop, $iWidth = -1, $iHeight = -1, $iStyle = -1, $iExStyle = -1)
_GDIPlus_Startup()
Local $idPic = GUICtrlCreatePic("", $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFilename)
If $iWidth = -1 Then $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
If $iHeight = -1 Then $iHeight = _GDIPlus_ImageGetHeight($hBitmap)
Local $hBitmap_Resized = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Local $hBMP_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Resized)
_GDIPlus_GraphicsSetInterpolationMode($hBMP_Ctxt, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC)
_GDIPlus_GraphicsDrawImageRect($hBMP_Ctxt, $hBitmap, 0, 0, $iWidth, $iHeight)
Local $hHBitmap = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap_Resized)
Local $hPrevImage = GUICtrlSendMsg($idPic, $STM_SETIMAGE, 0, $hHBitmap) ; $STM_SETIMAGE = 0x0172
_WinAPI_DeleteObject($hPrevImage); Delete Prev image if any
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBitmap_Resized)
_GDIPlus_GraphicsDispose($hBMP_Ctxt)
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_Shutdown()
Return $idPic
EndFunc ;==>_GUICtrlPic_Create
Alles anzeigen
- GUI wird geöffnet und ENDE-Button erzeugt
- wenn ich "ENDE bzw ESC" drücke ... sollte das Fenster der "_MsgBox"-Funktion erscheinen und mich nach meiner Meinung fragen !!!
Ich sehe es nur kurz flacker und dann kann ich die Anwendung nur über die Taskleiste (... Exit) beenden
Die Console sagt das "§idMsgNo" ständig gedrückt wird ...
Ich denke die While-Wend-Struktur ist für 2 Fenster richtig aufgebaut...
In meinem Projekt hab ich noch mehr Fenster die über Button aufgerufen werden. Das funktionier ...
Warum die _MesgBox nicht