1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 14:45

    Danke Ahnungslos (obwohl ich es bin :D )! uchar gibt es nicht als Typ. Wenn ich char nehme, bekomme ich was zurück!

    [autoit]


    $dll = DllOpen("GetCoreTempInfo.dll")
    $CORE_TEMP_SHARED_DATA = DllStructCreate("uint uiLoad[256];uint uiTjMax[128];uint uiCoreCnt;uint uiCPUCnt;float fTemp[256];float fVID;float fCPUSpeed;float fFSBSpeed;float fMultipier;char sCPUName[100];char ucFahrenheit;char ucDeltaToTjMax")
    $call = DllCall($dll, "int", "fnGetCoreTempInfoAlt", "ptr", DllStructGetPtr($CORE_TEMP_SHARED_DATA))
    ConsoleWrite(@error & @CRLF)

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($CORE_TEMP_SHARED_DATA) & @CRLF & _
    "Struct pointer: " & DllStructGetPtr($CORE_TEMP_SHARED_DATA) & @CRLF & _
    "CPU Speed: " & DllStructGetData($CORE_TEMP_SHARED_DATA, "fCPUSpeed"))
    $CORE_TEMP_SHARED_DATA = 0
    DllClose($dll)

    [/autoit]

    Danke,
    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 14:27

    Habe ich auch bereits getestet - gleiches Problem.

    Bald fange ich auch richtig mit C/C++ an, habe bereits "Hello World" in C++ erstellt (krass)! :thumbup:

    Ich verstehe nicht ganz die C++ Strukturen, um den beigefügten Text richtig zu folgen! ?(

    Danke,
    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 14:18

    Dann schmiert AutoIt ab -> AutoIT3.exe ended.rc:-1073741811 (0xC000000D):

    Problemsignatur:
    Problemereignisname: BEX
    Anwendungsname: autoit3.exe
    Anwendungsversion: 3.3.0.0
    Anwendungszeitstempel: 4951fa16
    Fehlermodulname: MSVCR80.dll
    Fehlermodulversion: 8.0.50727.4016
    Fehlermodulzeitstempel: 49cc5361
    Ausnahmeoffset: 00050458
    Ausnahmecode: c000000d
    Ausnahmedaten: 00000000
    Betriebsystemversion: 6.0.6002.2.2.0.256.4
    Gebietsschema-ID: 1031
    Zusatzinformation 1: f8e2
    Zusatzinformation 2: d04fb6ee658f7d3cee66529a2d481744
    Zusatzinformation 3: cee4
    Zusatzinformation 4: a036d36cbb9a043e18b9e0e91c87e6cd

    Lesen Sie unsere Datenschutzrichtlinie:
    http://go.microsoft.com/fwlink/?linkid=50163&clcid=0x0407

    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 14:09

    "bool" existiert nicht als Typ!

    Danke,
    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 13:46

    Hi,

    ich versuche gerade mich mit DllStructCreate() und DLLCall() zu beschäfftigen, weil ich kein Plan von der Sache habe.
    Als Übung wollte ich die DLL GetCoreTempInfo.dll laden und die Werte entsprechend herauslesen.

    Da ich auch noch keine Ahnung von C/C++ habe, ist der Versuch natürlich misslungen:

    Spoiler anzeigen
    [autoit]


    #cs
    Shared memory implementation in Core Temp:

    [/autoit] [autoit][/autoit] [autoit]

    Core Temp shares the following structure:

    [/autoit] [autoit][/autoit] [autoit]

    typedef struct core_temp_shared_data
    {
    unsigned int uiLoad[256];
    unsigned int uiTjMax[128];
    unsigned int uiCoreCnt;
    unsigned int uiCPUCnt;
    float fTemp[256];
    float fVID;
    float fCPUSpeed;
    float fFSBSpeed;
    float fMultipier;
    char sCPUName[100];
    unsigned char ucFahrenheit;
    unsigned char ucDeltaToTjMax;
    }CORE_TEMP_SHARED_DATA,*PCORE_TEMP_SHARED_DATA,**PPCORE_TEMP_SHARED_DATA;

    [/autoit] [autoit][/autoit] [autoit]

    unsigned int is a 32bit unsigned integer.
    unsigned char is 8bit (1 byte) in size.

    [/autoit] [autoit][/autoit] [autoit]

    ucFahrenheit and ucDeltaToTjMax represent boolean values. 0 = false, 1 = true.
    If ucFahrenheit is set, the temperature is reported in Fahrenheit.
    If ucDeltaToTjMax is set, the temperature reported respresents the distance from TjMax.

    [/autoit] [autoit][/autoit] [autoit]

    Core Temp's shared area is named: "CoreTempMappingObject".

    [/autoit] [autoit][/autoit] [autoit]

    C++ Dynamic Link Library:

    [/autoit] [autoit][/autoit] [autoit]

    This DLL was written in C++, and it can be easily used with most programming languages.
    There is only a single function. Here is the internal function declaration:

    [/autoit] [autoit][/autoit] [autoit]

    bool __declspec(dllimport) fnGetCoreTempInfo(CORE_TEMP_SHARED_DATA *&pData);

    [/autoit] [autoit][/autoit] [autoit]

    You can declare it in your program in the following manner:

    [/autoit] [autoit][/autoit] [autoit]

    typedef bool (*fnGetCoreTempInfo)(CORE_TEMP_SHARED_DATA *&pData);
    fnGetCoreTempInfo GetCoreTempInfo;

    [/autoit] [autoit][/autoit] [autoit]

    For compatibility with some programming languages a function was added.
    It uses Win32 API calling convention and is declared as follows:

    [/autoit] [autoit][/autoit] [autoit]

    bool WINAPI fnGetCoreTempInfoAlt(CORE_TEMP_SHARED_DATA *pData);

    [/autoit] [autoit][/autoit] [autoit]

    typedef bool (*fnGetCoreTempInfoAlt)(CORE_TEMP_SHARED_DATA *pData);
    fnGetCoreTempInfoAlt GetCoreTempInfo;

    [/autoit] [autoit][/autoit] [autoit]

    Usage:

    [/autoit] [autoit][/autoit] [autoit]

    * Declare a pointer to CORE_TEMP_SHARED_DATA structure and allocate it.
    It is also recommended to fill the allocated memory with NULL to avoid possible problems.
    * Call the function using the pointer to CORE_TEMP_SHARED_DATA structure as an argument.
    The function will fill the structure if the shared memory was successfully read.
    * The function returns 'true' if succeeded and 'false' if it failed. You can use GetLastError() in case the function fails.
    * In case the function fails due to an exception GetLastError() returns UNKNOWN_EXCEPTION (0x20000000)
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    $CORE_TEMP_SHARED_DATA = DllStructCreate("uint uiLoad[256];uint uiTjMax[128];uint uiCoreCnt;uint uiCPUCnt;float fTemp[256];float fVID;float fCPUSpeed;float fFSBSpeed;float fMultipier;char sCPUName[100];uchar ucFahrenheit;uchar ucDeltaToTjMax")
    $call = DllCall("GetCoreTempInfo.dll", "ptr", DllStructGetPtr($CORE_TEMP_SHARED_DATA))
    ConsoleWrite(@error & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($CORE_TEMP_SHARED_DATA) & @CRLF & _
    "Struct pointer: " & DllStructGetPtr($CORE_TEMP_SHARED_DATA) & @CRLF & _
    "Data:" & @CRLF & _
    DllStructGetData($CORE_TEMP_SHARED_DATA,1) & @CRLF & _
    DllStructGetData($CORE_TEMP_SHARED_DATA,2) & @CRLF & _
    DllStructGetData($CORE_TEMP_SHARED_DATA,3) & @CRLF & _
    DllStructGetData($CORE_TEMP_SHARED_DATA,4))
    $CORE_TEMP_SHARED_DATA = 0

    [/autoit]

    Ich bekomme als Error 3 zurück, wenn ich die DLL aufrufe (kann die Funktion in der DLL nicht finden)!

    Bitte um Hilfe!

    DANKE,
    UEZ

  • GDI+-Hilfe?

    • UEZ
    • 12. Dezember 2009 um 01:42

    Bitte sehr:

    Spoiler anzeigen
    [autoit]


    ;Coded by UEZ 2009.12.12
    #include <GDIplus.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $width = @DesktopWidth
    Global $height = @DesktopHeight
    _GDIPlus_Startup()
    Global $load_img1 = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\background_0.png")
    Global $img1_x = _GDIPlus_ImageGetWidth($load_img1)
    Global $img1_y = _GDIPlus_ImageGetHeight($load_img1)
    Global $load_img2 = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\background_1.png")
    Global $img2_x = _GDIPlus_ImageGetWidth($load_img2)
    Global $img2_y = _GDIPlus_ImageGetHeight($load_img2)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hwnd = GUICreate("Notizzettel", $width, $height, -1, -1, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))

    [/autoit] [autoit][/autoit] [autoit]

    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    ;~ _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

    [/autoit] [autoit][/autoit] [autoit]

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

    [/autoit] [autoit][/autoit] [autoit]

    ; _WinAPI_UpdateLayeredWindow parameters
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent(-3, "_Exit")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(30)
    _GDIPlus_GraphicsDrawImage($backbuffer, $load_img1, 0, 0) ;draw background
    _GDIPlus_GraphicsDrawImage($backbuffer, $load_img2, $img2_x, 0) ;draw foreground
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hWnd, $ScreenDc)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_Shutdown()
    WinClose($hwnd)
    Exit
    EndFunc

    [/autoit]

    Gute Nacht,
    UEZ

    Dateien

    GDI+ Beispiel.au3 2,27 kB – 408 Downloads
  • GDI+ Graphic über einen Hintergrund bewegen

    • UEZ
    • 11. Dezember 2009 um 21:51

    Bitte. Ist der Code verständlich?

    Gruß,
    UEZ

  • Hilfe bei Arrays gesucht

    • UEZ
    • 11. Dezember 2009 um 21:50

    So bekomme ich keine Fehlermeldung!

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <Misc.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{ESC}", "ende")
    HotKeySet("{Up}", "up")
    HotKeySet("{Down}", "down")
    HotKeySet("{Left}", "left")
    HotKeySet("{Right}", "right")
    HotKeySet("{Space}", "shoot")
    HotKeySet("w", "b1up")
    HotKeySet("s", "b1down")
    HotKeySet("a", "b1left")
    HotKeySet("d", "b1right")
    HotKeySet("q", "b1shoot")

    [/autoit] [autoit][/autoit] [autoit]

    start()

    [/autoit] [autoit][/autoit] [autoit]

    Func start()
    Global $dam = "Bilder\main1rechts.jpg"
    Global $bam = "Bilder\bot1links.jpg"
    Global $pam = "Bilder\panzervorne.jpg"
    Global $m = 1
    Global $b = 1
    Global $xmain = 100
    Global $ymain = 100
    Global $xb1 = 100
    Global $yb1 = 100
    Global $ak = 0

    [/autoit] [autoit][/autoit] [autoit]

    Global $gui1 = GUICreate("Autoitshooter", 810, 600, 100, 75)
    Global $hintergrund = GUICtrlCreateLabel("", 16, 50, 777, 417)
    GUICtrlSetBkColor($hintergrund, 0x0)
    Global $main1 = GUICtrlCreatePic($dam, 100, 200, 40, 40)
    Global $bot1 = GUICtrlCreatePic($bam, 500, 200, 40, 40)
    Global $panzer = GUICtrlCreatePic($pam, 520, 300, 110, 110)
    Global $leben = GUICtrlCreateProgress(16, 496, 393, 25)
    Global $mana = GUICtrlCreateProgress(16, 536, 393, 25)
    Global $waffe1 = GUICtrlCreateButton("Waffe1", 424, 496, 73, 67, 0)
    Global $waffe2 = GUICtrlCreateButton("Waffe2", 504, 496, 73, 67, 0)
    Global $waffe3 = GUICtrlCreateButton("Waffe3", 584, 496, 73, 67, 0)
    Global $spezial = GUICtrlCreateButton("Spezial", 664, 496, 129, 67, 0)
    Global $datei = GUICtrlCreateMenu("&Datei")
    Global $start = GUICtrlCreateMenuItem("Start", $datei)
    Global $pause = GUICtrlCreateMenuItem("Pause", $datei)
    Global $ende = GUICtrlCreateMenuItem("Ende", $datei)
    Global $optionen = GUICtrlCreateMenu("&Optionen")
    Global $hotkeys = GUICtrlCreateMenu("&Hotkeys")
    Global $about = GUICtrlCreateMenu("&About")
    Global $copyright = GUICtrlCreateMenuItem("Copyright", $about)
    Global $mainpos = ControlGetPos("Autoitshooter", "", $main1)
    Global $bot1pos = ControlGetPos("Autoitshooter", "", $bot1)
    Global $panzerpos = ControlGetPos("Autoitshooter", "", $panzer)
    Global $xmain = $mainpos[0]
    Global $ymain = $mainpos[1]
    Global $xb1 = $bot1pos[0]
    Global $yb1 = $bot1pos[1]
    GUISetState(@SW_SHOW)
    GUICtrlSetData($leben, 100)
    GUICtrlSetData($mana, 100)
    EndFunc ;==>start

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    Select
    Case $msg = $start
    GUIDelete($gui1)
    start()
    Case $msg = $pause And $ak = 0
    $ak = 1
    GUICtrlSetData($pause, "Weiter")
    Case $msg = $pause And $ak = 1
    $ak = 0
    GUICtrlSetData($pause, "Pause")
    Case $msg = $copyright
    MsgBox(64, "Copyright", "(C)2009, Retrokid")
    Case $msg = $ende
    Exit
    Case $msg = $spezial
    $bam = "Bilder\bot1blut.jpg"
    GUICtrlDelete($bot1)
    $bot1 = GUICtrlCreatePic($bam, $xb1, $yb1, 40, 40)
    GUICtrlSetState($bot1, $Gui_Disable)
    GUICtrlSetData($mana, 0)
    GUICtrlSetState($spezial, $Gui_Disable)
    $man = 0
    For $ma = 1 To 100 Step 1
    Sleep(500)
    $man += 1
    GUICtrlSetData($mana, $man)
    If $mainpos[1] = $bot1pos[1] And $mainpos[0] < $bot1pos[0] And ($bot1pos[0] - $mainpos[0]) < 270 Then
    $bam = ""
    b1left()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[1] = $bot1pos[1] And $mainpos[0] > $bot1pos[0] And ($mainpos[0] - $bot1pos[0]) < 270 Then
    $bam = ""
    b1right()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] < $bot1pos[1] And ($bot1pos[1] - $mainpos[1]) < 270 Then
    $bam = ""
    b1up()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] > $bot1pos[1] And ($mainpos[1] - $bot1pos[1]) < 270 Then
    $bam = ""
    b1down()
    Sleep(600)
    b1shoot()
    Sleep(700)
    EndIf
    If $mainpos[1] = $bot1pos[1] And $mainpos[0] < $bot1pos[0] Then
    b1left()
    Sleep(700)
    ElseIf $mainpos[1] = $bot1pos[1] And $mainpos[0] > $bot1pos[0] Then
    b1right()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] < $bot1pos[1] Then
    b1up()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] > $bot1pos[1] Then
    b1down()
    Sleep(700)
    EndIf
    Next
    GUICtrlSetState($spezial, $Gui_Enable)
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    If $mainpos[1] = $bot1pos[1] And $mainpos[0] < $bot1pos[0] And ($bot1pos[0] - $mainpos[0]) < 270 Then
    $bam = ""
    b1left()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[1] = $bot1pos[1] And $mainpos[0] > $bot1pos[0] And ($mainpos[0] - $bot1pos[0]) < 270 Then
    $bam = ""
    b1right()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] < $bot1pos[1] And ($bot1pos[1] - $mainpos[1]) < 270 Then
    $bam = ""
    b1up()
    Sleep(600)
    b1shoot()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] > $bot1pos[1] And ($mainpos[1] - $bot1pos[1]) < 270 Then
    $bam = ""
    b1down()
    Sleep(600)
    b1shoot()
    Sleep(700)
    EndIf
    If $mainpos[1] = $bot1pos[1] And $mainpos[0] < $bot1pos[0] Then
    b1left()
    Sleep(700)
    ElseIf $mainpos[1] = $bot1pos[1] And $mainpos[0] > $bot1pos[0] Then
    b1right()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] < $bot1pos[1] Then
    b1up()
    Sleep(700)
    ElseIf $mainpos[0] = $bot1pos[0] And $mainpos[1] > $bot1pos[1] Then
    b1down()
    Sleep(700)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $panzerpos[0] - $mainpos[0] < 200 Then
    GUICtrlDelete($main1)
    ElseIf $mainpos[0] - $panzerpos[0] < 200 Then
    GUICtrlDelete($main1)
    ElseIf $panzerpos[1] - $mainpos[1] < 200 Then
    GUICtrlDelete($main1)
    ElseIf $mainpos[1] - $panzerpos[1] < 200 Then
    GUICtrlDelete($main1)
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func ende()
    Exit
    EndFunc ;==>ende

    [/autoit] [autoit][/autoit] [autoit]

    Func up()
    If $dam = "Bilder\main1vorne.jpg" Then
    $ymain -= 20
    $m = 1
    GUICtrlSetPos($main1, $xmain, $ymain)
    ElseIf $ak = 1 Then
    Sleep(1)
    $dam = ""
    Else
    GUICtrlDelete($main1)
    $m = 1
    $dam = "Bilder\main1vorne.jpg"
    $main1 = GUICtrlCreatePic($dam, $xmain, $ymain, 40, 40)
    GUICtrlSetState($main1, $Gui_Disable)
    EndIf
    EndFunc ;==>up

    [/autoit] [autoit][/autoit] [autoit]

    Func down()
    If $dam = "Bilder\main1unten.jpg" Then
    $ymain += 20
    $m = 2
    GUICtrlSetPos($main1, $xmain, $ymain)
    ElseIf $ak = 1 Then
    Sleep(1)
    $dam = ""
    Else
    GUICtrlDelete($main1)
    $m = 2
    $dam = "Bilder\main1unten.jpg"
    $main1 = GUICtrlCreatePic($dam, $xmain, $ymain, 40, 40)
    GUICtrlSetState($main1, $Gui_Disable)
    EndIf
    EndFunc ;==>down

    [/autoit] [autoit][/autoit] [autoit]

    Func left()
    If $dam = "Bilder\main1links.jpg" Then
    $xmain -= 20
    $m = 3
    GUICtrlSetPos($main1, $xmain, $ymain)
    ElseIf $ak = 1 Then
    Sleep(1)
    $dam = ""
    Else
    GUICtrlDelete($main1)
    $m = 3
    $dam = "Bilder\main1links.jpg"
    $main1 = GUICtrlCreatePic($dam, $xmain, $ymain, 40, 40)
    GUICtrlSetState($main1, $Gui_Disable)
    EndIf
    EndFunc ;==>left

    [/autoit] [autoit][/autoit] [autoit]

    Func right()
    If $dam = "Bilder\main1rechts.jpg" Then
    $xmain += 20
    $m = 4
    GUICtrlSetPos($main1, $xmain, $ymain)
    ElseIf $ak = 1 Then
    Sleep(1)
    $dam = ""
    Else
    GUICtrlDelete($main1)
    $m = 4
    $dam = "Bilder\main1rechts.jpg"
    $main1 = GUICtrlCreatePic($dam, $xmain, $ymain, 40, 40)
    GUICtrlSetState($main1, $Gui_Disable)
    EndIf
    EndFunc ;==>right

    [/autoit] [autoit][/autoit] [autoit]

    Func shoot()
    If $ak = 1 Then
    Sleep(1)
    $m = 0
    EndIf
    If $m = 1 Then
    $muni = GUICtrlCreateLabel("", $xmain, $ymain, 2, 2)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 20)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 60)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 100)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 140)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 180)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 220)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 29, $ymain - 260)
    Sleep(150)
    GUICtrlDelete($muni)
    ElseIf $m = 2 Then
    $muni = GUICtrlCreateLabel("", $xmain, $ymain, 2, 2)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 50)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 90)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 130)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 170)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 210)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 250)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 10, $ymain + 290)
    Sleep(150)
    GUICtrlDelete($muni)
    ElseIf $m = 3 Then
    $muni = GUICtrlCreateLabel("", $xmain, $ymain, 2, 2)
    GUICtrlSetPos($muni, $xmain - 10, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 50, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 90, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 130, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 170, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 210, $ymain + 10)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain - 250, $ymain + 10)
    Sleep(150)
    GUICtrlDelete($muni)
    ElseIf $m = 4 Then
    $muni = GUICtrlCreateLabel("", $xmain, $ymain, 2, 2)
    GUICtrlSetPos($muni, $xmain + 50, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 90, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 130, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 170, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 210, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 250, $ymain + 29)
    Sleep(150)
    GUICtrlSetPos($muni, $xmain + 290, $ymain + 29)
    Sleep(150)
    GUICtrlDelete($muni)
    EndIf
    EndFunc ;==>shoot

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func b1up()
    If $bam = "Bilder\bot1vorne.jpg" Then
    $yb1 -= 20
    $b = 1
    GUICtrlSetPos($bot1, $xb1, $yb1)
    ElseIf $ak = 1 Then
    Sleep(1)
    $bam = ""
    Else
    GUICtrlDelete($bot1)
    $b = 1
    $bam = "Bilder\bot1vorne.jpg"
    $bot1 = GUICtrlCreatePic($bam, $xb1, $yb1, 40, 40)
    GUICtrlSetState($bot1, $Gui_Disable)
    EndIf
    EndFunc ;==>b1up

    [/autoit] [autoit][/autoit] [autoit]

    Func b1down()
    If $bam = "Bilder\bot1unten.jpg" Then
    $yb1 += 20
    $b = 2
    GUICtrlSetPos($bot1, $xb1, $yb1)
    ElseIf $ak = 1 Then
    Sleep(1)
    $bam = ""
    Else
    GUICtrlDelete($bot1)
    $b = 2
    $bam = "Bilder\bot1unten.jpg"
    $bot1 = GUICtrlCreatePic($bam, $xb1, $yb1, 40, 40)
    GUICtrlSetState($bot1, $Gui_Disable)
    EndIf
    EndFunc ;==>b1down

    [/autoit] [autoit][/autoit] [autoit]

    Func b1left()
    If $bam = "Bilder\bot1links.jpg" Then
    $xb1 -= 20
    $b = 3
    GUICtrlSetPos($bot1, $xb1, $yb1)
    ElseIf $ak = 1 Then
    Sleep(1)
    $bam = ""
    Else
    GUICtrlDelete($bot1)
    $b = 3
    $bam = "Bilder\bot1links.jpg"
    $bot1 = GUICtrlCreatePic($bam, $xb1, $yb1, 40, 40)
    GUICtrlSetState($bot1, $Gui_Disable)
    EndIf
    EndFunc ;==>b1left

    [/autoit] [autoit][/autoit] [autoit]

    Func b1right()
    If $bam = "Bilder\bot1rechts.jpg" Then
    $xb1 += 20
    $b = 4
    GUICtrlSetPos($bot1, $xb1, $yb1)
    ElseIf $ak = 1 Then
    Sleep(1)
    $bam = ""
    Else
    GUICtrlDelete($bot1)
    $b = 4
    $bam = "Bilder\bot1rechts.jpg"
    $bot1 = GUICtrlCreatePic($bam, $xb1, $yb1, 40, 40)
    GUICtrlSetState($bot1, $Gui_Disable)
    EndIf
    EndFunc ;==>b1right

    [/autoit] [autoit][/autoit] [autoit]

    Func b1shoot()
    If $ak = 1 Then
    Sleep(1)
    $b = 0
    EndIf
    If $b = 1 Then
    $munib1 = GUICtrlCreateLabel("", $xb1, $yb1, 2, 2)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 20)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 60)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 100)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 140)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 180)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 220)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 29, $yb1 - 260)
    Sleep(150)
    GUICtrlDelete($munib1)
    ElseIf $b = 2 Then
    $munib1 = GUICtrlCreateLabel("", $xb1, $yb1, 2, 2)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 50)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 90)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 130)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 170)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 210)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 250)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 10, $yb1 + 290)
    Sleep(150)
    GUICtrlDelete($munib1)
    ElseIf $b = 3 Then
    $munib1 = GUICtrlCreateLabel("", $xb1, $yb1, 2, 2)
    GUICtrlSetPos($munib1, $xb1 - 10, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 50, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 90, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 130, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 170, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 210, $yb1 + 10)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 - 250, $yb1 + 10)
    Sleep(150)
    GUICtrlDelete($munib1)
    ElseIf $b = 4 Then
    $munib1 = GUICtrlCreateLabel("", $xb1, $yb1, 2, 2)
    GUICtrlSetPos($munib1, $xb1 + 50, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 90, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 130, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 170, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 210, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 250, $yb1 + 29)
    Sleep(150)
    GUICtrlSetPos($munib1, $xb1 + 290, $yb1 + 29)
    Sleep(150)
    GUICtrlDelete($munib1)
    EndIf
    EndFunc ;==>b1shoot

    [/autoit] [autoit][/autoit] [autoit]

    ;noch unwichtig-------------------------
    Func _RectCollision($Rect1X1, $Rect1Y1, $Rect1X2, $Rect1Y2, $Rect2X1, $Rect2Y1, $Rect2X2, $Rect2Y2)
    ; Prog@ndy
    Local Const $tagRECT = "long;long;long;long"
    Local $1 = DllStructCreate($tagRECT)
    Local $2 = DllStructCreate($tagRECT)
    Local $3 = DllStructCreate($tagRECT)
    DllStructSetData($1, 1, $Rect1X1)
    DllStructSetData($1, 2, $Rect1Y1)
    DllStructSetData($1, 3, $Rect1X2)
    DllStructSetData($1, 4, $Rect1Y2)
    DllStructSetData($2, 1, $Rect2X1)
    DllStructSetData($2, 2, $Rect2Y1)
    DllStructSetData($2, 3, $Rect2X2)
    DllStructSetData($2, 4, $Rect2Y2)
    Local $r = DllCall("User32.dll", "int", "IntersectRect", "ptr", DllStructGetPtr($3), "ptr", DllStructGetPtr($1), "ptr", DllStructGetPtr($2))
    If @error Then Return SetError(1, 0, 0)
    Return $r[0] <> 0
    EndFunc ;==>_RectCollision

    [/autoit]


    Gruß,
    UEZ

  • Hilfe bei Arrays gesucht

    • UEZ
    • 11. Dezember 2009 um 21:44

    Zunächst mal würde ich die Variablendeklaration Global aus der While Schleife nach oben verschieben (Reihenfolge der Global Anweisungen beachten)!

    Gruß,
    UEZ

  • Hilfe bei Arrays gesucht

    • UEZ
    • 11. Dezember 2009 um 21:33

    Sehr wahrscheinlich ist $mainpos kein Array. Prüfe es doch mal mit IsArray()!

    Gruß,
    UEZ

  • GDI+ Graphic über einen Hintergrund bewegen

    • UEZ
    • 11. Dezember 2009 um 21:15

    Meinst du sowas?

    Spoiler anzeigen
    [autoit]


    ;Coded by UEZ 2009.12.11
    #include <GDIplus.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Global $load_background = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Background.png")
    Global $load_foreground = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Smiley.png")
    Global $width = _GDIPlus_ImageGetWidth($load_background)
    Global $height = _GDIPlus_ImageGetHeight($load_background)
    Global $dx = _GDIPlus_ImageGetWidth($load_foreground)
    Global $dy = _GDIPlus_ImageGetHeight($load_foreground)
    Global Const $pi_div_180 = 4 * ATan(1) / 180
    Global $radius = 60
    Global $i, $x = $width / 2 - $dx / 2, $y = $height / 2 - $dy / 2

    [/autoit] [autoit][/autoit] [autoit]

    Global $hwnd = GUICreate("GDI+: Example by UEZ", $width, $height, -1, -1, Default)
    GUISetOnEvent(-3, "_Exit")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    ;~ _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

    [/autoit] [autoit][/autoit] [autoit]

    $i = 0
    While Sleep(30)
    _GDIPlus_GraphicsDrawImage($backbuffer, $load_background, 0, 0) ;draw background
    _GDIPlus_GraphicsDrawImage($backbuffer, $load_foreground, $x + Cos($i * $pi_div_180) * $radius, $y + Sin($i * $pi_div_180) * $radius) ;draw foreground
    $i += 2
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]

    Im Anhang unten sind die Bilder!

    Gruß,
    UEZ

    Dateien

    GDI+ Beispiel.7z 450,98 kB – 256 Downloads
  • Bei Hover - Rand einer GDI-Grafik ändern

    • UEZ
    • 11. Dezember 2009 um 15:36

    Hier die GDI+ Version:

    Spoiler anzeigen
    [autoit]


    #include <GUICtrlSetOnHover.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    $GUIMain = GUICreate("Test", 200, 150)
    GUISetOnEvent(-3, "Quit")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $DUMMY = GUICtrlCreateLabel("", 10, 10, 100, 100)
    GUICtrlSetBkColor(-1, -2)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUIMain)
    _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
    $pen_size = 4
    $hPen1 = _GDIPlus_PenCreate(0xFFFF0000, $pen_size)
    $hPen2 = _GDIPlus_PenCreate(0xFF000000, $pen_size)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillRect($hGraphic, 10, 10, 100, 100)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrl_SetOnHover($DUMMY, "_Hover_Proc", "_Leave_Hover_Func")

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(50)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Hover_Proc($iCtrlID, $iParam)
    _GDIPlus_GraphicsDrawRect($hGraphic, 10 + $pen_size / 2, 10 + $pen_size / 2, 100 - $pen_size, 100 - $pen_size, $hPen1)
    EndFunc ;==>_Hover_Proc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Leave_Hover_Func($iCtrlID)
    _GDIPlus_GraphicsDrawRect($hGraphic, 10 + $pen_size / 2, 10 + $pen_size / 2, 100 - $pen_size, 100 - $pen_size, $hPen2)
    EndFunc ;==>_Leave_Hover_Func

    [/autoit] [autoit][/autoit] [autoit]

    Func Quit()
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>Quit

    [/autoit]

    Gruß,
    UEZ

  • ObjGet() und IsObj()

    • UEZ
    • 10. Dezember 2009 um 16:17
    Zitat von ojo

    Hi,

    kontrollier mal den Dienst Remote-Registrierung. Falls er nicht gestartet sein sollte -> starten.

    ;-))
    Stefan

    Das ist nicht das Problem, sondern, wenn ich mein Skript starte, soll es unabhängig von den Remote Diensten laufen und nicht mit dem Fehler den Dienst quittieren.

    Abgesehen davon kann ich mich mit Regedit auf das Remote System verbinden ;)

    Ich werde es mal, wie von funkey vorgeschlagen, mit RegRead() probieren.

    Gruß,
    UEZ

  • ObjGet() und IsObj()

    • UEZ
    • 10. Dezember 2009 um 15:44
    Zitat von nuts

    Liegt der Schluss nahe, dass deine Anfrage nicht korrekt ist.
    http://msdn.microsoft.com/en-us/library/aa390788(VS.85).aspx

    Auf anderen System bekomme ich den Wert zurück, nur nicht auf diesem System. Wo siehst du den Fehler?

    UEZ

  • ObjGet() und IsObj()

    • UEZ
    • 10. Dezember 2009 um 15:22

    Brauche mal Hilfe hierzu:

    Wenn ich mit ObjGet() eine WMI Verbindung zu einem Remote System aufbaue

    $objReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $srv & "\root\default:StdRegProv")

    und mit

    If IsObj($objReg) Then

    das Objekt abfrage, hab ich das Problem, dass zwar $objReg zwar als Objekt erkannt wird, aber meine nächste Abfrage

    $objReg.GetStringValue($HKLM, $BaseKey, "Test", $OS_TEST)

    die Fehlermeldung

    Line -1:

    Error: The requested action with this object has failed.

    erscheint.

    Wenn ich mit Scriptomatic das System abfrage, kommt nichts zurück. Ich gehe davon aus, dass eine Verbing zwar aufgebaut wird, aber es kommen keine Werte zurück.

    Hat jemand eine Idee?

    Hier ein Extrakt des Codes:

    [autoit]


    ...
    $HKLM = 0x80000002
    $BaseKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
    $objReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $srv & "\root\default:StdRegProv")

    [/autoit][autoit][/autoit][autoit]

    If IsObj($objReg) Then
    $objReg.GetStringValue($HKLM, $BaseKey, "Test", $OS_TEST)
    Else
    ...

    [/autoit]


    Danke,
    UEZ

  • Decompiler unschädlich machen

    • UEZ
    • 10. Dezember 2009 um 10:09

    Meine Meinung dazu ist, dass es keinen absoluten Schutz gibt!

    Z.B. die Spieleindustrie hat sich die wildesten Kopierschutzmechanismen ausgedacht und trotzdem werden die Spiele geknackt! Oder die Cracks und Keygens zu diversen Programmen. Haben sich die Programmieren keine Gedanken über Schutzmaßnahmen gemacht? Ich denke doch.

    Zu AutoIt: wenn jemand den Skill hat, wird er den Code knacken und den Code reversen. Wenn ich meine AutoIt Programm kommerzialisieren will, dann muss ich damit rechnen, dass er geknackt wird.

    Jos und Co. kann den Code von der Exe wiederherstellen - also ist eine Möglichkeit doch möglich!

    Gruß,
    UEZ

  • XP-CD Key auslesen

    • UEZ
    • 9. Dezember 2009 um 09:47

    Habe den Code in #18 geändert. Bitte nochmals checken!

    Danke

  • XP-CD Key auslesen

    • UEZ
    • 8. Dezember 2009 um 21:31

    Hier der Versuch den Key auch von x64 Systemen zu lesen. Da das ganze über WMI läuft, können auch Remote System abgefragt werden.

    Da ich momentan Zuhause bin, kann ich den Remote Check nicht durchführen!

    Für einen Test von einem x32 auf einen x64 System wäre ich dankbar!

    Spoiler anzeigen
    [autoit]


    #AutoIt3Wrapper_UseUpx=n
    ;~ #AutoIt3Wrapper_Change2CUI=y

    [/autoit] [autoit][/autoit] [autoit]

    If $CmdLine[0] > 0 Then
    MsgBox(0, "Windows OS Product Key", DecodeProductKey($CmdLine[1]))
    Else
    MsgBox(0, "Windows OS Product Key", DecodeProductKey("localhost"))
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Func DecodeProductKey($srv)
    Local $objWMILocator, $objRegService, $BaseKey, $BaseKey64, $oReg, $Product_Key, $Key, $arrSubKeys, $i, $t, $p
    Dim $BinaryDPID, $TempBinaryDPID
    $BaseKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
    $BaseKey64 = "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\"
    $strValueName = "DigitalProductId"
    Const $HKLM = 0x80000002

    [/autoit] [autoit][/autoit] [autoit]

    $oReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $srv & "\root\default:StdRegProv")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If IsObj($oReg) Then
    If @OSArch = "X64" And ($srv = @ComputerName Or _ ;local check
    $srv = "localhost" Or _
    $srv = @IPAddress1 Or _
    $srv = @IPAddress2 Or _
    $srv = @IPAddress3 Or _
    $srv = @IPAddress4) Then
    $BinaryDPID = StringMid(RegRead("HKEY_LOCAL_MACHINE\" & $BaseKey, $strValueName), 3) ;if exe is x64
    If $BinaryDPID = "" Then $BinaryDPID = StringMid(RegRead("HKEY_LOCAL_MACHINE64\" & $BaseKey, $strValueName), 3) ;otherwise exe is x32
    Else
    $oReg.GetBinaryValue($HKLM, $BaseKey, "DigitalProductId", $Product_Key) ;remote check
    If Not IsArray($Product_Key) Then
    $oReg.GetBinaryValue($HKLM, $BaseKey64, "DigitalProductId", $Product_Key)
    EndIf
    $BinaryDPID = ""
    For $i = 0 To UBound($Product_Key) - 1
    $BinaryDPID &= Hex($Product_Key[$i], 2)
    Next
    EndIf
    Local $bKey[15]
    Local $sKey[29]
    Local $Digits[24]
    Local $Value = 0
    Local $hi = 0
    Local $n = 0
    Local $i = 0
    Local $dlen = 29
    Local $slen = 15
    Local $ProductKey
    $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "")
    $BinaryDPID = StringMid($BinaryDPID, 105, 30)
    For $i = 1 To 29 Step 2
    $bKey[Int($i / 2)] = Dec(StringMid($BinaryDPID, $i, 2))
    Next
    For $i = $dlen - 1 To 0 Step -1
    If Mod(($i + 1), 6) = 0 Then
    $sKey[$i] = "-"
    Else
    $hi = 0
    For $n = $slen - 1 To 0 Step -1
    $Value = BitOR(BitShift($hi, -8), $bKey[$n])
    $bKey[$n] = Int($Value / 24)
    $hi = Mod($Value, 24)
    Next
    $sKey[$i] = $Digits[$hi + 1]
    EndIf
    Next
    For $i = 0 To 28
    $ProductKey = $ProductKey & $sKey[$i]
    Next
    SetError(0)
    Return $ProductKey
    Else
    SetError(1)
    MsgBox(16, "ERROR", "An error has occured!", 10)
    EndIf
    EndFunc ;==>DecodeProductKey

    [/autoit]

    Danke,
    UEZ

  • GDI+: Filled Brushes

    • UEZ
    • 8. Dezember 2009 um 13:05

    Ups, stimmt :whistling: Habe den Code + Anhang entsprechend aktualisiert!

    Nichtsdestotrotz danke für beide Dateien.

    Sorry,
    UEZ

  • GDI+: Filled Brushes

    • UEZ
    • 8. Dezember 2009 um 08:14

    Ein kleines Beispiel dazu:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2009
    #include <GDIplus.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $width = @DesktopWidth / 2
    Global Const $height = @DesktopHeight / 2
    Global Const $pi_div_180 = 4 * ATan(1) / 180

    [/autoit] [autoit][/autoit] [autoit]

    Global $hwnd = GUICreate("Border Collision with Hatch Brushes!", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUISetOnEvent($GUI_EVENT_CLOSE, "Close") ;$GUI_EVENT_CLOSE = -3
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Move") ;move main window
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

    [/autoit] [autoit][/autoit] [autoit]

    Global $max_dots = 20
    Global $max_speed = 5
    Global $iWidth = 100
    Global $iHeight = 100
    Dim $coordinates[$max_dots][5], $angle
    Dim $brush[$max_dots]
    Global $hImage[$max_dots]
    Global $hContext
    Global $hBrush
    Global $sleep = 40

    [/autoit] [autoit][/autoit] [autoit]

    Initialize()

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwnd, "int", 0, "int", $sleep, "int", 0)
    ;~ $hCallBack = DllCallbackRegister("Draw", "none", "") ;crashing on exit
    ;~ DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwnd, "int", 0, "int", $sleep, "ptr", DllCallbackGetPtr($hCallBack))

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Until False * Not Sleep(1000)

    [/autoit] [autoit][/autoit] [autoit]

    Func Move() ;move whole window when pressed lmb and hold continuing drawing of window content
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $WM_NCLBUTTONDOWN, "int", 2, "int", 0) ;$WM_NCLBUTTONDOWN = 0x00A1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Draw()
    _GDIPlus_GraphicsClear($backbuffer, 0xFF000000)
    Draw_Dots()
    Calculate_New_Position()
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Initialize()
    For $k = 0 To $max_dots - 1
    $hImage[$k] = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    $hBrush = _GDIPlus_HatchBrushCreate(Random(0, 52, 1), "0xD0" & Hex(Random(0x400000, 0xFFFFFF, 1), 6), 0xFFFFFFFF)
    $hContext = _GDIPlus_ImageGetGraphicsContext($hImage[$k])
    _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iWidth, $iWidth, $hBrush)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BrushDispose($hBrush)
    New_Coordinates($k)
    Next
    EndFunc ;==>Initialize

    [/autoit] [autoit][/autoit] [autoit]

    Func Draw_Dots()
    Local $i, $temp_x, $temp_y
    For $i = 0 To $max_dots - 1
    _GDIPlus_GraphicsDrawImageRect($backbuffer, $hImage[$i], $coordinates[$i][0], $coordinates[$i][1], $iWidth, $iHeight)
    Next
    EndFunc ;==>Draw_Dots

    [/autoit] [autoit][/autoit] [autoit]

    Func New_Coordinates($k)
    $coordinates[$k][0] = $width / 2 ;Random($width / 20, $width - $width / 20, 1);start x position
    $coordinates[$k][1] = $height / 2 ;Random($height / 20, $height - $height / 20, 1) ;start y position
    $coordinates[$k][2] = Random(1, $max_speed, 1) ;speed of pixel
    $angle = Random(0, 359, 1)
    ;~ ConsoleWrite("Angle: " & $angle & "°" & @CRLF)
    $coordinates[$k][3] = $coordinates[$k][2] * Cos($angle * $pi_div_180)
    $coordinates[$k][4] = $coordinates[$k][2] * Sin($angle * $pi_div_180)
    EndFunc ;==>New_Coordinates

    [/autoit] [autoit][/autoit] [autoit]

    Func Calculate_New_Position()
    Local $k
    For $k = 0 To $max_dots - 1
    $coordinates[$k][0] += $coordinates[$k][3] ;increase x coordinate with appropriate slope
    $coordinates[$k][1] += $coordinates[$k][4] ;increase y coordinate with appropriate slope
    If $coordinates[$k][0] <= 0 Then ;border collision x left
    $coordinates[$k][0] = 1
    $coordinates[$k][3] *= -1
    ElseIf $coordinates[$k][0] >= $width - $iWidth Then ;border collision x right
    $coordinates[$k][0] = $width - ($iWidth + 1)
    $coordinates[$k][3] *= -1
    EndIf
    If $coordinates[$k][1] <= 0 Then ;border collision y top
    $coordinates[$k][1] = 1
    $coordinates[$k][4] *= -1
    ElseIf $coordinates[$k][1] >= $height - $iHeight Then ;border collision y bottom
    $coordinates[$k][1] = $height - ($iHeight + 1)
    $coordinates[$k][4] *= -1
    EndIf
    Next
    EndFunc ;==>Calculate_New_Position

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[6]
    EndFunc ;==>_GDIPlus_BitmapCreateFromScan0

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_HatchBrushCreate($iHatchStyle = 0, $iARGBForeground = 0xFFFFFFFF, $iARGBBackground = 0xFFFFFFFF)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateHatchBrush", "int", $iHatchStyle, "uint", $iARGBForeground, "uint", $iARGBBackground, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[4]
    EndFunc ;==>_GDIPlus_HatchBrushCreate

    [/autoit] [autoit][/autoit] [autoit]

    Func close()
    GUIRegisterMsg($WM_TIMER, "")
    GUIRegisterMsg($WM_TIMER, "")
    ;~ DllCallbackFree($hCallBack)
    For $k = 0 To $max_dots-1
    _GDIPlus_ImageDispose($hImage[$k])
    Next
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close

    [/autoit]

    Danke an Authenticity für die GDIp Bibliothek und die Hilfe die Kugel so zu füllen, dass die Muster nicht statisch im Hintergrund sind!

    Gruß,
    UEZ

    PS: GDIp.au3 + GDIpConstants.au3 werden für das Beispiel oben nicht mehr benötigt. Funktionen sind nun im Code integriert. Nichtsdestotrotz ein "must have" und sollte in keiner Sammlung fehlen!
    +: nun wird das Fenster weitergezeichnet, auch wenn das Fenster verschoben wird!

    Dateien

    Hatch Brushes Example 3.au3 5,54 kB – 354 Downloads

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™