Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/30/2021 in all areas

  1. No. They do not share the same handle... Edit : recently I tested both approaches, and _WinAPI_* are faster than File* to perform the same job. JFYI
    2 points
  2. Ok, but FileClose uses file handles, yet you seem not to be familiar with them: I would have to doubt it, GPU’s have strength in numbers having hundreds of cores, but the cores themselves are weak compared to a CPU core. They’re good for parallel processing. But writing to a file on a single device is not easily amendable to parallelism; the contention and race conditions would be tricky. Plus, your data is already at the CPU or DMA, so you would have to get it to the GPU just to start it.
    1 point
  3. nend

    Change wallpaper

    Maybe this is something for you. I made this a while ago but never finnished it. #Include <GDIPlus.au3> _GDIPlus_Startup () ConsoleWrite(@AppDataDir & "\Microsoft\Windows\Themes\TranscodedWallpaper" & @CRLF) FileCopy(@AppDataDir & "\Microsoft\Windows\Themes\TranscodedWallpaper", @AppDataDir & "\Nend Software\Weerstation Online\Current Wallpaper.bmp", 8) _setwallpaper(@AppDataDir & "\Nend Software\Weerstation Online\Current Wallpaper.bmp", 10, 1) _GDIPlus_ShutDown() Func _setwallpaper($pic, $style = 0, $warn = 1) If $warn = 1 then $m1 = @DesktopHeight/2 $m2 = @DeskTopWidth/2 EndIf If Not FileExists($pic) Then Return -1 $sString = "Hello world" $hImage = _GDIPlus_ImageLoadFromFile($pic) $sCLSID = _GDIPlus_EncodersGetCLSID ("BMP") $GC = _GDIPlus_ImageGetGraphicsContext($hImage) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFont = _GDIPlus_FontCreate($hFamily, 62, 2) $tLayout = _GDIPlus_RectFCreate(600, 110, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($GC, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($GC, $sString, $hFont, $aInfo[0], $hFormat, $hBrush) $newBmp = _GDIPlus_BitmapCreateFromGraphics(@DeskTopWidth, @DesktopHeight, $GC) $newGC = _GDIPlus_ImageGetGraphicsContext($newBmp) _GDIPlus_GraphicsDrawImageRect($newGC, $hImage, 0, 0, @DeskTopWidth, @DesktopHeight) _GDIPlus_ImageSaveToFileEx($newBmp, @AppDataDir & "\Nend Software\Weerstation Online\Current Wallpaper set.bmp", $sCLSID) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($newBmp) _GDIPlus_GraphicsDispose($GC) _GDIPlus_GraphicsDispose($newGC) Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\", "TileWallPaper", "REG_SZ", 0) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\", "WallpaperStyle", "REG_SZ", $style) DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", @AppDataDir & "\Nend Software\Weerstation Online\Current Wallpaper set.bmp", _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 If $warn = 1 then Sleep(2000) EndIf EndFunc ;==>_setwallpaper
    1 point
×
×
  • Create New...