Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/19/2014 in all areas

  1. everseeker, No-one is forcing you to use AutoIt. If you really miss GoTo that much, please feel free to move to another language. M23
    1 point
  2. I didn't know that _GUIImageList_Create() can handle an image this way using sub frames (nice to know). You can use WinAPI_RedrawWindow() to erase the gfx. #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <WinAPI.au3> #include <GDIPlus.au3> HotKeySet("{esc}", "Quit") Example() Func Example() Global $hImage, $hGUI, $hDC, $iX _GDIPlus_Startup() ; Load Image Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\muybridge12-hp-f.jpg") ; 12 frames a 67x54 px -> 804x54 px in sum -> this is a GDIPlus image Local $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ; convert GDIPlus bitmap to GDI format which is usable for _GUIImageList* functions _GDIPlus_BitmapDispose($hBitmap) ; release GDIPlus bitmap because not needed anymore $hImages = _GUIImageList_Create(67, 54) ; dimension of the single frame _GUIImageList_Add($hImages, $hGDIBitmap) ; add the whole strip to the ImageList ; Create the example GUI $hGUI = GUICreate("ImageList Draw", 400, 300) GUISetState(@SW_SHOW) $hDC = _WinAPI_GetDC($hGUI) ; Retrieves a handle of a display device context for the client area a window Do For $i = 0 To 11; loop all frames $iX += 10 $iX = Mod($iX, 410) _WinAPI_RedrawWindow($hGui) ;redraw means erase graphical content in the GUI _GUIImageList_Draw($hImages, $i, $hDC, $iX, 4) ; Draws an image list item in the specified device context Sleep(50) Next Until False EndFunc ;==>Example Func Quit() ; free memory _GDIPlus_Shutdown() _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete() Exit EndFunc ;==>Quit I added some more comments to the source. You can draw a retangle to erase also the background of the drawn images. Br, UEZ
    1 point
  3. Then try this: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <WinAPI.au3> #include <GDIPlus.au3> Example() Func Example() Local $hImage, $hGUI, $hDC, $iX, $iY, $iIndex = 0 _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\muybridge12-hp-f.jpg") ; 12 frames a 67x54 px -> 804x54 px in sum Local $hBmp_tmp = _GDIPlus_BitmapCreateFromScan0(67, 54) Local $hCtxt_tmp = _GDIPlus_ImageGetGraphicsContext($hBmp_tmp) $hGUI = GUICreate("ImageList Draw", 400, 300) GUISetState(@SW_SHOW) ; Load images $hImages = _GUIImageList_Create(67, 54) For $i = 0 To 11 _GDIPlus_GraphicsDrawImageRectRect($hCtxt_tmp, $hBitmap, $i * 67, 0, 67, 54, 0, 0, 67, 54) $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp_tmp) _GUIImageList_Add($hImages, $hGDIBitmap) _WinAPI_DeleteObject($hGDIBitmap) Next _GDIPlus_GraphicsDispose($hCtxt_tmp) _GDIPlus_BitmapDispose($hBmp_tmp) _GDIPlus_BitmapDispose($hBitmap) ; Draw images $hDC = _WinAPI_GetDC($hGUI) For $iY = 0 To 2 For $iX = 0 to 3 _GUIImageList_Draw($hImages, $iIndex, $hDC, 4 + $iX * 67, 4 + $iY * 54) Next Next _WinAPI_ReleaseDC($hGUI, $hDC) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() _GDIPlus_Shutdown() EndFunc ;==>Example Br, UEZ
    1 point
  4. Melba23

    Loops

    akke92, Your earlier thread was locked, as I explained when I did so, because it involved automating a game server - as that is pops up when I Google "Extalia". Limiting your question to understanding While loops I am just about prepared to accept - but not if you make it too obviously linked. M23
    1 point
  5. This stopped working for me on my work machine and the problem appears to be that I have UAC enabled without having the registry key set. i.e. HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA Does not exist but I'm still using UAC. I can only imagine this is because UAC is set through Group Policy or something. I have worked round this by adding the key which is fine for my purposes.
    1 point
×
×
  • Create New...