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

  • ==> Variable must be of type "Object".:

    • UEZ
    • 16. Dezember 2009 um 11:48

    Der Code kommt mir bekannt vor ;)


    Probier's mal so!

    Spoiler anzeigen
    [autoit]


    ;Coded by UEZ 2009
    #AutoIt3Wrapper_Change2CUI=y
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseX64=n
    #include <array.au3>
    Global $server = "localhost"
    If $CmdLine[0] > 0 Then $server = $CmdLine[1]

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

    $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $server & "\root\cimv2")

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

    Membership_Administrators_Local($server)

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

    Func Membership_Administrators_Local($srv)
    If StringUpper($srv) = StringUpper("Localhost") Then $srv = @ComputerName
    Local $function_name = "Members"
    Local $LM_members, $x, $LM_LocalGroup_Name, $type, $colItems2, $LM_local_user, $y, $line, $TimeStamp
    Local $filename_ms = $function_name & "_" & $srv
    Local $filename_error_current = $function_name & "_" & $srv & "_error.log"
    $LM_LocalGroup_Name = "Administrators"
    $colItems = $objWMIService.ExecQuery("Select SID from Win32_Group WHERE Domain='" & $srv & "'", "WQL", 0x30)
    If IsObj($colItems) Then
    For $objItem In $colItems
    If StringUpper($objItem.SID) = StringUpper("S-1-5-32-544") Then $LM_LocalGroup_Name = $objItem.Name
    Next
    EndIf
    $type = ""
    $LM_local_user = ""
    $colItems = $objWMIService.ExecQuery("Select * from Win32_GroupUser Where GroupComponent=""Win32_Group.Domain='" & $srv & "',Name='" & $LM_LocalGroup_Name & "'""", "WQL", 0x30)
    If IsObj($colItems) Then
    For $objItem In $colItems
    If $objItem.PartComponent <> "" Then
    $x = StringSplit($objItem.PartComponent, """")
    $type = StringMid($x[1], StringInStr($x[1], ":Win32_") + 7, (StringInStr($x[1], ".") - (StringInStr($x[1], ":Win32_") + 7)))
    $LM_members &= $srv & ";" & $LM_LocalGroup_Name & ";" & $type & ";" & $x[2] & "\" & $x[4] & ";" & @CRLF
    EndIf
    Next
    EndIf
    ConsoleWrite($LM_members)
    EndFunc ;==>Membership_Administrators_Local

    [/autoit]

    Gruß,
    UEZ

  • ==> Variable must be of type "Object".:

    • UEZ
    • 16. Dezember 2009 um 11:23

    Die Sache ist leider nicht immer so einfach -> [ gelöst ] ObjGet() und IsObj()

    Ich musste ein Error Handler einbauen, damit das Skript erstmal weiterläuft!

    [autoit]


    ...
    Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
    ...
    Func _ErrFunc()
    Return
    EndFunc
    ---

    [/autoit]

    Gru,
    UEZ

  • Monochromzeichnen eines Bildes

    • UEZ
    • 16. Dezember 2009 um 09:43
    Zitat von Andy

    Genau deshalb habe ich ja geschrieben, daß man die in GDI+ "eingebauten" Funktionen für diese speziellen Sachen verwenden soll, WENN sie schneller sind...
    Die von mir geposteten Beispiele zeigen einen direkten Weg zu den Bitmapdaten und haben mit GDI+ nichts zu tun. Obwohl ich mir ehrlich gesagt mit GDI+ einen abgebrochen habe, einzelne Pixel oder Bereiche aus Bildern auszulesen, was aber wahrscheinlich auch daran liegt, daß eine Datei zu öffnen, die Pixeldaten in ein Array einzulesen und weiterzuverarbeiten wesentlich einfacher und auch schneller ist.

    Wir nehmen das Graustufenbild der Mona Lisa und suchen alle Pixel mit einer bestimmten "Farbe" um damit z.B. ein bisschen Steganographie zu machen. Dann wäre es nützlich, einen 1:1 Bildvergleich zu machen und/oder die geänderten Pixel zu finden. Das könnte man mit GDI+ und ein bisschen cleverem Bitblt auch versuchen, allerdings bekommt man so weder Position noch Farbe der Pixel, sondern hat wieder ein weiteres "DifferenzBild".
    Wie bekommt man Informationen aus verrauschten Bildern einer Webcam? Wie lese ich den "Text" per OCR aus einem Bild? Alles Anwendungen, bei denen man direkt auf die Rohdaten zugreifen muß.... und einem GDI+ i.d.R. sehr wenig bringt...

    Na ändere doch im von UEZ geposteten Script einfach die Parameter. Schwarz/weiß ist doch nur die extremste Form der Graustufen.
    Oder füge in meinem Script (habe extra eine Leerzeile gelassen^^) in Zeile 27 ein:

    [autoit]

    if $grau<128 then
    $grau = 0
    Else
    $grau=255
    endif

    [/autoit]
    Alles anzeigen

    Anmerkung: mit dem Benchmark wollte ich nur den Geschwindigkeitsunterschied darstellen und NICHT, dass dein Code irgendwie schlecht/schlechter ist als das GDI+ Beispiel!

    Je nach Anwendung kann man sich ja den entstprechenden Code aussuchen!

    Gruß,
    UEZ

  • Bild in die .exe machen

    • UEZ
    • 15. Dezember 2009 um 23:35

    Schau' mal hier nach: http://www.autoitscript.com/forum/index.php?showtopic=51103 oder hier: http://www.autoitscript.com/forum/index.php?showtopic=77430 .

    Gruß,
    UEZ

  • Monochromzeichnen eines Bildes

    • UEZ
    • 15. Dezember 2009 um 23:29
    Zitat von Andy

    Hi,
    ja, habe eine relativ schnelle Lösung(en) im engl. Forum gepostet, Zedna meinte sogar, ich solle meine Beispiele mal zusammenfassen und im dortigen Example-Forum publik machen....na schaumamal....

    Man muß die Dateien nicht unbedingt "sichtbar" machen, die Operationen direkt in der Bitmap sind wesentlich schneller und auch unkomplizierter (m.E.) als GDI+ (obschon man auch schon bei GDI+ auf "fertige" Funktionen zurückgreifen kann.
    Ich habe Dein "Bild nach Schwarzweiß" mal als Beispiel verwendet:
    Mona Lisa downloaden und im scriptverzeichnis speichern

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GDIPlusConstants.au3>
    #include <StructureConstants.au3>
    #include <WinAPI.au3>
    ; quick and dirty....
    Global $stride, $ptr, $pixeldata
    global $bitmapfile1, $width1, $height1, $stride1, $pbitmap1
    global $bitmapfile2, $width2, $height2, $stride2, $pbitmap2
    local $numberdiff = 0 ;number of differences between the 2 pics

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

    $pic1 = "mona-lisa.jpg" ;the image....24bit per pixel, could be a JPG which you want to have gray
    $pic3 = "grey.bmp" ;a bitmapfile with the greyscale

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

    $t=timerinit()
    _GDIPlus_Startup()
    $pixelstruct1 = getbmpdata($pic1, $width1, $height1, $stride1, $pbitmap1) ;get all data from file

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

    $lenght = DllStructGetSize($pixelstruct1) ;get lenght of bitmapdata
    $pixelstruct3 = dllstructcreate("ubyte["&$lenght&"]")
    ;compare
    for $i=1 to $lenght step 3
    $B=dllstructgetdata($pixelstruct1,1,$i) ;Farbanteil B
    $G=dllstructgetdata($pixelstruct1,1,$i+1) ;Farbanteil G
    $R=dllstructgetdata($pixelstruct1,1,$i+2) ;Farbanteil R
    $grau=int(($b+$g+$R)/3)

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

    dllstructsetdata($pixelstruct3,1,$grau,$i) ;write the difference into the difference-file, bottom-up isnt funny but we´ll mirror it later :o)
    dllstructsetdata($pixelstruct3,1,$grau,$i+1) ;write the difference into the difference-file, bottom-up isnt funny but we´ll mirror it later :o)
    dllstructsetdata($pixelstruct3,1,$grau,$i+2) ;write the difference into the difference-file, bottom-up isnt funny but we´ll mirror it later :o)
    next

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

    $head=DllStructcreate("ubyte[54]")
    ;lets create a bitmapfile with the given data
    $Bmpheader = DllStructCreate("align 1;char BM[2];uint Size;uint res;uint Offset;uint BMHI;uint Width;uint Height;short Planes;short BPP;uint BIcomp;int SizeImg;uint reshor;uint resver;uint col;uint colused", dllstructgetptr($head)) ;struct of bytes = header of bitmap #1
    ;fill struct(bitmapheader) with data
    DllStructSetData($bmpheader,"BM","BM")
    DllStructSetData($bmpheader,"Size",54+$lenght)
    DllStructSetData($bmpheader,"Offset",54)
    DllStructSetData($bmpheader,"BMHI",40)
    DllStructSetData($bmpheader,"Width",$width1)
    DllStructSetData($bmpheader,"Height",-$height1) ;negativ because "bottom up"
    DllStructSetData($bmpheader,"Planes",1)
    DllStructSetData($bmpheader,"BPP",24)
    DllStructSetData($bmpheader,"BIcomp",0)
    DllStructSetData($bmpheader,"SizeImg",$lenght)

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

    $header = dllstructgetdata($head,1) ;headerdata
    $pixeldata = stringtrimleft(DllStructGetData($pixelstruct3, 1),2) ;pixeldata
    $bitmap = $header&$pixeldata ;all together is the bitmap-file

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

    $filehandle = FileOpen($pic3, 18) ;write file
    FileWrite($filehandle,BinaryToString($bitmap))
    FileClose($filehandle)

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

    _GDIPlus_ImageDispose($pBitmap1) ;not in the function, because ImageDispose destroys the struct
    ;_GDIPlus_ImageDispose($pBitmap2)
    $m=timerdiff($t)/1000

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

    ;lets have a look what we have done...
    GUICreate("Pic2Gray "&$width1&"x"&$height1&" = "&$width1*$Height1&" Pixel in "&int($m)&" Seconds => "&int($width1*$Height1/$m)&" Pixel/Second",800,500)
    GUICtrlCreatePic($pic1, 10, 10, 350, 350 / $width1 * $height1)
    GUICtrlCreatePic($pic3, 400, 10, 350, 350 / $width1* $height1)
    GUISetState()

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

    Do
    Until GUIGetMsg() = -3

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

    Func getbmpdata($bmpfile, ByRef $width, ByRef $height, ByRef $stride, Byref $pbitmap) ;returns a struct with the data of the pixel
    $pbitmap = _GDIPlus_BitmapCreateFromFile($bmpfile)
    ;_GDIPlus_BitmapLockBits gibt $tagGDIPBITMAPDATA-Struktur zurück
    $BitmapData = _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB)
    If @error Then MsgBox(0, "", "Error locking region " & @error)
    $stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.
    $width = DllStructGetData($BitmapData, "Width");Image width - Number of pixels in one scan line of the bitmap.
    $height = DllStructGetData($BitmapData, "Height");Image height - Number of scan lines in the bitmap.
    ;$pixelFormat = DllStructGetData($BitmapData, "PixelFormat");Pixel format - Integer that specifies the pixel format of the bitmap
    $Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap.
    $pixeldata = DllStructCreate("ubyte[" & (Abs($stride) * ($height)) & "]", $Scan0)
    $BMPData = DllStructGetData($pixeldata, 1)
    _WinAPI_DeleteObject($pbitmap)
    _GDIPlus_BitmapUnlockBits($pBitmap, $BmpData)
    ;_GDIPlus_ImageDispose($pBitmap) ;destroys the pixeldatastruct, have to be done at end of the script!
    return $pixeldata
    EndFunc ;==>getbmpdata

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

    Das von UEZ gepostete Beispiel benutzt z.B. eins dieser in GDI+ "eingebauten" Features, in diesem Fall die Beeinflussung der Farben. Um aber in eine(r) Datei zu "malen" bzw einzelne Bytes zu lesen/beeinflussen muß man schauen, welche Funktion am besten "hinhaut".

    Alles anzeigen


    Ich war so frei und habe dein Beispiel gegen das GDI+ laufen lassen -> deins 3s. und GDI+ 45ms!

    Gruß,
    UEZ

  • Monochromzeichnen eines Bildes

    • UEZ
    • 15. Dezember 2009 um 21:34

    Hier ein Beispiel, um ein Bild in Graustufen umzuwandeln (ist aus dem engl. Forum)!

    Spoiler anzeigen
    [autoit]


    ;http://www.autoitscript.com/forum/index.ph…ndpost&p=513472
    #Include <GDIPlus.au3>

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

    _GDIPlus_Startup()

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

    $img = FileOpenDialog("Select an image", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png;*.gif)", 1)

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

    $hImage1 = _GDIPlus_ImageLoadFromFile($img)
    $hImage2 = _GDIPlus_ImageGreyscale($hImage1)
    $ext = StringMid($img, StringLen($img) -2)
    $sCLSID = _GDIPlus_EncodersGetCLSID ($ext)
    _GDIPlus_ImageSaveToFileEx($hImage2, StringMid($img, 1, StringLen($img) - 4) & "_grey." & $ext, $sCLSID)
    $iwx = _GDIPlus_ImageGetWidth($hImage2)
    $iwy = _GDIPlus_ImageGetHeight($hImage2)
    $hGUI = GUICreate("Convert image to greyscale by Siao", $iwx, $iwy)
    GUISetState()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iwx, $iwy)

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

    While GUIGetMsg() <> -3 * Sleep(50)
    WEnd

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

    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)

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

    _GDIPlus_ShutDown()
    Exit

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

    ;; _GDIPlus_ImageGreyscale()
    ;; Creates a greyscale copy of Image object and returns its handle. To destroy it, use _GDIPlus_ImageDispose() or _GDIPlus_BitmapDispose()
    Func _GDIPlus_ImageGreyscale(Const ByRef $hImage)
    Local $tColorMatrix, $x, $hImgAttrib, $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage), $hGraphics, $hGraphics2, $hBitmap
    ;;create color matrix data
    $tColorMatrix = DllStructCreate("float[5];float[5];float[5];float[5];float[5]")
    ;greyscale values:
    $x = DllStructSetData($tColorMatrix, 1, 0.30, 1) * DllStructSetData($tColorMatrix, 1, 0.30, 2) * DllStructSetData($tColorMatrix, 1, 0.30, 3) * _
    DllStructSetData($tColorMatrix, 2, 0.59, 1) * DllStructSetData($tColorMatrix, 2, 0.59, 2) * DllStructSetData($tColorMatrix, 2, 0.59, 3) * _
    DllStructSetData($tColorMatrix, 3, 0.11, 1) * DllStructSetData($tColorMatrix, 3, 0.11, 2) * DllStructSetData($tColorMatrix, 3, 0.11, 3) * _
    DllStructSetData($tColorMatrix, 4, 1.00, 4) * DllStructSetData($tColorMatrix, 5, 1.00, 5)
    ;;create an image attributes object and update its color matrix
    $hImgAttrib = _GDIPlus_ImageAttributesCreate()
    _GDIPlus_ImageAttributesSetColorMatrix($hImgAttrib, 1, DllStructGetPtr($tColorMatrix))
    ;;copy image
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    $hGraphics2 = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    ;;draw original into copy with attributes
    _GDIPlus_GraphicsDrawImageRectRectEx($hGraphics2, $hImage, 0, 0, $iW, $iH, 0, 0, $iW, $iH, 2, $hImgAttrib)
    ;;clean up
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics2)
    _GDIPlus_ImageAttributesDispose($hImgAttrib)

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

    Return $hBitmap
    EndFunc

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

    ;;;;; other GDIPlus wrappers ;;;;;

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

    #cs
    _GDIPlus_ImageAttributesSetColorMatrix()
    Sets ColorMatrix of ImageAttributes object
    Parameters:
    $hImgAttrib = ImageAttributes object
    $iColorAdjustType = can be:
    ColorAdjustTypeDefault = 0
    ColorAdjustTypeBitmap = 1
    ColorAdjustTypeBrush = 2
    ColorAdjustTypePen = 3
    ColorAdjustTypeText = 4
    ColorAdjustTypeCount = 5
    ColorAdjustTypeAny (Reserved) = 6
    $pColorMatrix = pointer to ColorMatrix structure
    $pGrayMatrix = pointer to GreyMatrix structure
    $iColorMatrixFlags = can be:
    ColorMatrixFlagsDefault = 0
    ColorMatrixFlagsSkipGrays = 1
    ColorMatrixFlagsAltGray = 2
    Return value: True/False
    #ce
    Func _GDIPlus_ImageAttributesSetColorMatrix($hImgAttrib, $iColorAdjustType, $pColorMatrix = 0, $pGrayMatrix = 0, $iColorMatrixFlags = 0)
    Local $fEnable = 1, $aResult = DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr",$hImgAttrib, "int",$iColorAdjustType, _
    "int",$fEnable, "ptr",$pColorMatrix, "ptr",$pGrayMatrix, "int",$iColorMatrixFlags)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc

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

    ;;Creates ImageAttributes object
    Func _GDIPlus_ImageAttributesCreate()
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    Return SetError($aResult[0], 0, $aResult[1])
    EndFunc

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

    ;;Deletes ImageAttributes object
    Func _GDIPlus_ImageAttributesDispose($hImgAttrib)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc

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

    ;; _GDIPlus_GraphicsDrawImageRectRectEx()
    ;; Same as _GDIPlus_GraphicsDrawImageRectRect(), but adds 1 optional parameter - $hImgAttrib (handle to ImageAttributes object)
    Func _GDIPlus_GraphicsDrawImageRectRectEx($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $hImgAttrib = 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGraphics, "hwnd", $hImage, "int", $iDstX, "int", _
    $iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
    $iSrcHeight, "int", $iUnit, "ptr", $hImgAttrib, "int", 0, "int", 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc

    [/autoit]

    Gruß,
    UEZ

    PS: hatte das Speichern nicht richtig durchdacht :rolleyes:

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 15:50

    Danke progandy!


    Hier meine Version:

    Spoiler anzeigen
    [autoit]


    If Not FileExists(@ScriptDir & "\GetCoreTempInfo.dll") Or Not ProcessExists("Core Temp.exe") Then
    MsgBox(16,"Error", "Core Temp.exe läuft und/oder GetCoreTempInfo.dll existiert nicht", 20)
    Exit
    EndIf
    $dll = DllOpen(@ScriptDir & "\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];ubyte ucFahrenheit;ubyte ucDeltaToTjMax")
    $call = DllCall($dll, "int", "fnGetCoreTempInfoAlt", "ptr", DllStructGetPtr($CORE_TEMP_SHARED_DATA))

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

    $CPU_Name = DllStructGetData($CORE_TEMP_SHARED_DATA, "sCPUName")
    $CPU_Speed = Round(DllStructGetData($CORE_TEMP_SHARED_DATA, "fCPUSpeed"),0)
    $CPU_Cores = DllStructGetData($CORE_TEMP_SHARED_DATA, "uiCoreCnt")
    $CPU_FSB_Speed = Round(DllStructGetData($CORE_TEMP_SHARED_DATA, "fFSBSpeed"), 0)
    $CPU_Multiplicator = DllStructGetData($CORE_TEMP_SHARED_DATA, "fMultipier")
    $CPU_Temp = ""
    For $i = 1 To DllStructGetData($CORE_TEMP_SHARED_DATA, 'uiCoreCnt')
    $CPU_Temp &= DllStructGetData($CORE_TEMP_SHARED_DATA, "fTemp", $i) & ","
    Next
    $CPU_Temp = StringMid($CPU_Temp, 1 , StringLen($CPU_Temp) - 1)

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

    MsgBox(0,"Core Temp", _
    "CPU Name: " & $CPU_Name & @CRLF & _
    "CPU Speed: " & $CPU_Speed & " MHz" & @CRLF & _
    "CPU Cores: " & $CPU_Cores & @CRLF & _
    "CPU FSB Speed: " & $CPU_FSB_Speed & " MHz" & @CRLF & _
    "CPU Multiplicator: " & $CPU_Multiplicator & @CRLF & _
    "CPU Temp: " & $CPU_Temp & " C")
    $CORE_TEMP_SHARED_DATA = 0
    DllClose($dll)

    [/autoit]

    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 15:39
    Zitat von Schnitzel

    UEZ im Monolog :rofl:

    Manchmal rede ich mit mir selbst! :D

    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 15:35

    Hab's: $CPU_Temp = DllStructGetData($CORE_TEMP_SHARED_DATA, "fTemp", [index])

    Wie viele Indices wurden benutzt? Kann man das herausbekommen?

    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 15:31

    Wie bekomme ich alle Werte für float fTemp[256] zurück?

    $CPU_Temp = DllStructGetData($CORE_TEMP_SHARED_DATA, "fTemp") liefert mir nur ein Wert zurück, erwarte aber 2 Werte!

    $CPU_Temp ist kein Array!

    Danke,
    UEZ

  • DllStructCreate() und DLLCall()

    • UEZ
    • 14. Dezember 2009 um 14:47
    Zitat von Ahnungslos

    beim drüberschaun ist mir auch gerade noch aufgefallen:
    müsste es nicht statt char byte und statt uchar ubyte heißen?

    edit: C++ hab ich auch mal begonnen und sehr schnell das Interessa dran verloren,
    find Nasm da toller, nur leider meckert mein Vierenscanner einige Programme danach an 8|

    ASM ist auch interessant, könnte es für einige zeitkritische Operationen in GDI+ benutzen, wenn ich nur ASM könnte!

    Gruß,
    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 – 276 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

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™