Hallo,
ich muß eine Nr. auslesen.
Jeder klick auf den Button zeigt mir die Nr. des Controls. OK!
Folgendes:
Wenn ich bei dem Button (Beispiel: die Main() Funktion
aktiviere, bekomme ich keine Nummer sondern True.
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Global $aLabel[1], $Label
$x = 140
$y = 110
$Form1 = GUICreate("Form1", 625, 443, 192, 124)
$Button1 = GUICtrlCreateButton("Label Nr", 408, 352, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
;_Main()
$aLabel[UBound($aLabel) - 1] = GUICtrlCreateLabel("Test", $x, $y, 146, 89)
$Label = $aLabel[UBound($aLabel) - 1]
Msgbox(0,"$Label",$Label)
EndSwitch
WEnd
Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
Local $sString = "Hello world", $aInfo
; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()
; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $sString, $hFont, $tLayout, $hFormat)
$aLabel[UBound($aLabel) - 1] = _GDIPlus_GraphicsDrawStringEx ($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
$Label = $aLabel[UBound($aLabel) - 1]
Msgbox(0,"$Label GDI",$Label)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main
[/autoit]Ich glaube hier liegt irgendwo der Fehler
[autoit]
$aLabel[UBound($aLabel) - 1] = _GDIPlus_GraphicsDrawStringEx ($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
$Label = $aLabel[UBound($aLabel) - 1]
Msgbox(0,"$Label GDI",$Label)
Ich brauche später den Zahlenwert damit ich die Strings v. GDI ermitteln kann.
Zum testen einfach ;_Main() aktivieren
Grüße
Ilse