ScottDuncan
04-10-2005, 12:33 PM
I'm working on a SetDesktop Backround function that i found here in the forum somewhere. I don't need all the user interaction that the .apz included, so i stripped out a bunch of the code. I simply need a button that onClick sets the desktop to an image that i specify and stretched to fit. I rearranged the code in a seperate project and it works perfectly. It includes a function call (on a button) and a global function. All seemed well.
Then in the project that i want to use this function, i placed the function call on a button and the global function in the globals. i also made sure to place the .jpg and the JPG2BMP.exe in the DOC folder.
It locks up my project and fails to function. i don't get it. i copied the code directly from a working version. Any help is always appreciated.
Here is my code (it's the same in both the working version and the broken one);
function call (onButtonClick)
SetWallpaper("Xplugz - Anne Frank 01 (Flor00).jpg", "Xplugz - Anne Frank 01 (Flor00)");
global function
function SetWallpaper(img, imgName)
imagesplit = String.SplitPath(img)
File.Run("AutoPlay\\Docs\\JPG2BMP.EXE", img .. ";;" .. _WindowsFolder .. "\\"..imgName..".bmp", "", SW_MINIMIZE, true);
Registry.SetValue(HKEY_CURRENT_USER, "Control Panel\\Desktop", "TileWallpaper", 0, REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER, "Control Panel\\Desktop", "WallpaperStyle", 2, REG_SZ);
DLL.CallFunction(_SystemFolder .. "\\User32.dll", "SystemParametersInfoA", "20,0,\"" .. _WindowsFolder .. "\\"..imgName..".bmp\",1", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
end
(I'm a beginner at coding so i write a lot of "Longhand code". In my function call, i send the filename without the extension for filenaming purposes, i just haven't figure the String.SplitPath action yet)
Then in the project that i want to use this function, i placed the function call on a button and the global function in the globals. i also made sure to place the .jpg and the JPG2BMP.exe in the DOC folder.
It locks up my project and fails to function. i don't get it. i copied the code directly from a working version. Any help is always appreciated.
Here is my code (it's the same in both the working version and the broken one);
function call (onButtonClick)
SetWallpaper("Xplugz - Anne Frank 01 (Flor00).jpg", "Xplugz - Anne Frank 01 (Flor00)");
global function
function SetWallpaper(img, imgName)
imagesplit = String.SplitPath(img)
File.Run("AutoPlay\\Docs\\JPG2BMP.EXE", img .. ";;" .. _WindowsFolder .. "\\"..imgName..".bmp", "", SW_MINIMIZE, true);
Registry.SetValue(HKEY_CURRENT_USER, "Control Panel\\Desktop", "TileWallpaper", 0, REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER, "Control Panel\\Desktop", "WallpaperStyle", 2, REG_SZ);
DLL.CallFunction(_SystemFolder .. "\\User32.dll", "SystemParametersInfoA", "20,0,\"" .. _WindowsFolder .. "\\"..imgName..".bmp\",1", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
end
(I'm a beginner at coding so i write a lot of "Longhand code". In my function call, i send the filename without the extension for filenaming purposes, i just haven't figure the String.SplitPath action yet)