corgano Posted February 20, 2010 Posted February 20, 2010 Sorry for the low quality thread, but its 2 am at time of writing. I need a way to speed up this script, anyone know of a better method? main loop: $mod = 10 while 1 _ScreenCapture_Capture($temp,0-$mod,0-$mod,@desktopwidth + $mod, @desktopheight + $mod, False) If Not FileExists($temp) Then Return -1 DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $temp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) WEnd Is there any way to set the desktop image to a hbitmap instead of needing to make it an image first? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Moderators Melba23 Posted February 20, 2010 Moderators Posted February 20, 2010 corgano,From the Help file for _ScreenCapture_Capture:RemarksIf FileName is blank, this function will capture the screen and return a HBITMAP handle to the bitmap image. In this case, after you are finished with the bitmap you must call _WinAPI_DeleteObject to delete the bitmap handle.I have used this function to return a HBITMAP handle successfully in several scripts.I hope you slept well! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
corgano Posted February 20, 2010 Author Posted February 20, 2010 (edited) I can get it to return the hbmp, but then I cannot set as the desktop. The setdesktopwalpaper() function I originally got did not support setting a bitmaphandle as the desktop, but would work with a file. Know of a function to set a hBitmap as the desktop wallpaper? original function: Func _ChangeDestopWallpaper($bmp, $style = 0) If Not FileExists($bmp) Then Return -1 Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop" if $style = 1 then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDestopWallpaper And, yes, I did try removing the "If Not FileExists($bmp) Then Return -1". It didn't help. Edited February 20, 2010 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now