Ist komisch, da ich auch die 3.3.12.0 verwende und der Code der Gleiche ist. Du könntest den Code mit der neusten Beta probieren.
Ansonsten keine Ahnung, warum es bei dir nicht läuft.
I.d.R. rasiere ich mich nicht täglich ![]()
Ist komisch, da ich auch die 3.3.12.0 verwende und der Code der Gleiche ist. Du könntest den Code mit der neusten Beta probieren.
Ansonsten keine Ahnung, warum es bei dir nicht läuft.
I.d.R. rasiere ich mich nicht täglich ![]()
Welche AutoIt Version benutzt du?
Funzt bei dir die Exe Version (siehe Anhang)?
Das geht auch. D.h. anstelle die Grafik zu löschen, muss du das vorige Bild in die Grafik kopieren.
Vielen Dank Eukalyptus! ![]()
Die Shuffle Befehle sind mir noch ein Rätsel. Ein Bild sagt mehr als 1000 Worte!
Wird wohl für meine ASM Kurse sehr nützlich sein.
Wolltest du sowas ähnliches: http://www.openprocessing.org/sketch/133247
Nee, das sich die Textur dreht, ist eigentlich nicht beabsichtigt gewesen. Eigentlich sollte sich nichts drehen und die Textur sollte nach unten bzw. oben sich wie ein Gummiband ziehen.
Ich suche mal nach dem Effekt.
Ich habe aus dem Effekt ein kleines Intro mit einem C64 SID Chip Sound gebastelt.
Den Source Code hier zu posten macht keinen Sinn, da der Code nun aus 3 Teilen besteht. D.h. nur als Download inkl. kompilierter Exe!
Sollte einigermaßen flüssig laufen.
Ich hoffe, es gefällt euch.
PS: wenn die CPU zu "schwach" ist, läuft das Timing für die Effekte nicht richtig -> DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", 30, "int", 0)) die 30 auf 40 oder höher setzen! Oder den Wert für $iStripes reduzieren, z.B. $iStripes = 200 setzen.
Auf meiner Kiste (Notebook / i5 CPU, Win8.1 x64) läuft das Intro mit ca. 30 FPS! KEIN WinXP SUPPORT!
Chip Sound Player von wakillon: autoitscript.com/forum/topic/169098-chiptunes-players/ (sehr empfehlenswert für Chip Sound Liebhaber)
Screenshot:
CoSiNUs brOTHerS inTRO.png
Video:
Was willst du denn mit dem Skript erreichen?
Probiere es mal damit:
[autoit]#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Global $sImageFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.bmp)")
If @error Then Exit MsgBox(0, "Information", "Nothing selected - stopping script!", 30)
_GDIPlus_Startup()
Global $hBitmap = _GDIPlus_BitmapCreateFromFile($sImageFile)
DrawTextOnBitmap($hBitmap, "This is a GDI+ demo", 50)
Global Const $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap)
Global Const $hGUI = GUICreate("GDI+ Test", $iW, $iH)
GUISetBkColor(0)
GUISetState()
Global Const $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global Const $hBmp = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
Global Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 2)
Global $fPosX = 0, $fPosY = 0, $iSpeed = $iH / 20
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iSpeed = ' & $iSpeed & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
AdlibRegister("Anim", 20)
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
AdlibUnRegister("Anim")
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_Shutdown()
GUIDelete()
Exit
EndSwitch
Until False
Func Anim()
_GDIPlus_GraphicsClear($hCtxt)
_GDIPlus_DrawImagePoints($hCtxt, $hBitmap, 0, 0, $iW, 0, $fPosX, $fPosY)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBmp, 0, 0, $iW, $iH)
$fPosY += ($fPosY < $iH) ? $iSpeed : AdlibUnRegister("Anim")
EndFunc
Func DrawTextOnBitmap(ByRef $hBitmap, $sText, $fFontSize, $sFontTyp = "Impact", $iInnerColor = 0xFFFFFFFF, $iBorderColor = 0xFF000000)
Local Const $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap)
Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hGfx, 4)
_GDIPlus_GraphicsSetTextRenderingHint($hGfx, 3)
_GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 2)
Local Const $hBrush_Inner = _GDIPlus_BrushCreateSolid($iInnerColor), $hPen_Border = _GDIPlus_PenCreate($iBorderColor, 1.5)
Local Const $hPath = _GDIPlus_PathCreate(), $hFamily = _GDIPlus_FontFamilyCreate($sFontTyp), $hFormat = _GDIPlus_StringFormatCreate()
Local Const $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
_GDIPlus_StringFormatSetAlign($hFormat, 1)
_GDIPlus_StringFormatSetLineAlign($hFormat, 1)
_GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fFontSize, $hFormat)
_GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush_Inner)
_GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen_Border)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_BrushDispose($hBrush_Inner)
_GDIPlus_PenDispose($hPen_Border)
_GDIPlus_PathDispose($hPath)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
EndFunc
Wenn du in der CMD Box nur wmic memphysical eingibst, dann bekommst du eine Tabelle zurück, die dir die WMI Klasse dafür zurück gibt.
CreationClassName
Win32_PhysicalMemoryArray
Oder Google ist dein persönlicher Freund. ![]()
Ok, dann probiere es mal damit:
[autoit]$sWMIService = "winmgmts:\\.\root\CIMV2"
$objWMIService = ObjGet($sWMIService)
If IsObj($objWMIService) Then
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemoryArray")
If IsObj($colItems) Then
For $oItem In $colItems
$MemoryDevices = $oItem.MemoryDevices
msgbox(0,"Speicherbänke", "Speicherbänke Anzahl: " & $MemoryDevices)
Next
Else
MsgBox(16, "Error", "Failed to get collection.")
EndIf
Else
MsgBox(4096, "ERROR", "Failed to connect to WMI at: " & $sWMIService)
EndIf
Ich gehe davon aus, dass du die Speichergröße auslesen willst.
Probiere es mal hiermit:
[autoit]
#include <WinAPIMisc.au3>
$sWMIService = "winmgmts:\\.\root\CIMV2"
$objWMIService = ObjGet($sWMIService)
If IsObj($objWMIService) Then
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_COMPUTERSYSTEM")
If IsObj($colItems) Then
For $oItem In $colItems
$rechnername = $oItem.Caption
$speicher = $oItem.TotalPhysicalMemory
msgbox(0,"",$rechnername & " / " & _WinAPI_StrFormatByteSize($speicher))
Next
Else
MsgBox(16, "Error", "Failed to get collection.")
EndIf
Else
MsgBox(4096, "ERROR", "Failed to connect to WMI at: " & $sWMIService)
EndIf
Den Ansatz hast du, haue rein, wie du es gerne hättest.
Ok, danke. Cooler wäre es, einen Button in die Leiste zu haben, anstatt über das Menu zu gehen.
Was mir noch aufgefallen ist, dass die Up-Down Buttons, z.B. Font Größe, die Ansicht (Live) oder nach dem Loslassen der Maustaste nicht aktualisiert. Man muss Enter drücken, damit
die Einstellungen übernommen werden. Auch hier wäre ein Live Ansicht cool.
Sollte das hier sein.
Wie kann ich den GUI Editor öffnen? Irgendwie sehe ich das nicht.
Der Source Code Link auf deiner Seite scheint auf die alte Version zu zeigen.
Keine Ahnung, ob's schon erwähnt wurde, aber die angepinnten Beiträge sind doppelt.
Du kannst ja dies mal als Ansatz nehmen:
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Global $sImageFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.bmp)")
If @error Then Exit MsgBox(0, "Information", "Nothing selected - stopping script!", 30)
_GDIPlus_Startup()
Global $hBitmap = _GDIPlus_BitmapCreateFromFile($sImageFile)
DrawTextOnBitmap($hBitmap, "This is a GDI+ demo", 50)
Global Const $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap)
Global Const $hGUI = GUICreate("GDI+ Test", $iW, $iH)
GUISetBkColor(0)
GUISetState()
Global Const $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global Const $hBmp = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
Global Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 2)
Global $fPosX = 0, $fPosY = 0
AdlibRegister("Anim", 30)
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
AdlibUnRegister("Anim")
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_Shutdown()
GUIDelete()
Exit
EndSwitch
Until False
Func Anim()
_GDIPlus_GraphicsClear($hCtxt)
_GDIPlus_DrawImagePoints($hCtxt, $hBitmap, 0, 0, $iW, 0, $fPosX, $fPosY)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBmp, 0, 0, $iW, $iH)
Local Static $iX = 0, $fAmpl = 40
$fPosY += ($fPosY <= $iH) ? 2 : 0
If $fPosY <= $iH Then
$fPosX = Cos($fPosY / 30) * $fAmpl
$iX = $fPosY
Else
$fPosX = Cos($iX / 30) * $fAmpl
$iX += 2
$fAmpl -= $fAmpl > 0 ? 0.25 : 0
If $fAmpl <= 0 Then AdlibUnRegister("Anim")
EndIf
EndFunc
Func DrawTextOnBitmap(ByRef $hBitmap, $sText, $fFontSize, $sFontTyp = "Impact", $iInnerColor = 0xFFFFFFFF, $iBorderColor = 0xFF000000)
Local Const $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap)
Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hGfx, 4)
_GDIPlus_GraphicsSetTextRenderingHint($hGfx, 3)
_GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 2)
Local Const $hBrush_Inner = _GDIPlus_BrushCreateSolid($iInnerColor), $hPen_Border = _GDIPlus_PenCreate($iBorderColor, 1.5)
Local Const $hPath = _GDIPlus_PathCreate(), $hFamily = _GDIPlus_FontFamilyCreate($sFontTyp), $hFormat = _GDIPlus_StringFormatCreate()
Local Const $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
_GDIPlus_StringFormatSetAlign($hFormat, 1)
_GDIPlus_StringFormatSetLineAlign($hFormat, 1)
_GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fFontSize, $hFormat)
_GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush_Inner)
_GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen_Border)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_BrushDispose($hBrush_Inner)
_GDIPlus_PenDispose($hPen_Border)
_GDIPlus_PathDispose($hPath)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
EndFunc
Ein Trapez mit dem Bild geht leider nicht, aber ein Parallelogramm schon! -> _GDIPlus_DrawImagePoints
Ich weiß zwar nicht, wo in dem Bild ein Trapez sein soll, aber das Ganze lässt sich ganz gut in GDI+ realisieren.