View Full Version : Set the background in LUA
BeRnA
May 25th, 2005, 08:23 AM
In G3 with the WinLuaEx there was a function to set the background.
What is the function in G4? I don't found anything in win table...
Promixis
May 25th, 2005, 08:44 AM
You mean people actually used that function?? :)
We can add it if there is a need.
BeRnA
May 25th, 2005, 09:00 AM
You mean people actually used that function?? :)
We can add it if there is a need.
Oh Yes, please add it...
I have a site that create background with the combination of 9 traffic camera pictures, and I want girder to retrive that image from time to time, and set as my background...
Promixis
May 25th, 2005, 09:36 AM
ah, ok. What is the windows api call again?
BeRnA
May 25th, 2005, 09:46 AM
I dont know what is the Windows API to change the background, but in the WinLuaEx plugin the function was SetDesktopBitmap(filename)
In the plugin source code:
int CLUAWindows::SetDesktopBitmap()
{
CString strError;
if (lua_gettop(m_pState) != 1)
{
strError.Format("This routine requires 1 parameter instead of %d",lua_gettop(m_pState));
}
else if (!(lua_isstring(m_pState, 1)))
{
strError.Format("The first argument must be a string instead of a %s",lua_typename(m_pState, lua_type(m_pState, 1)));
}
else
{
CString sFilename = lua_tostring(m_pState,1);; // .bmp filename
if (SystemParametersInfo(SPI_SETDESKWALLPAPER,0,(void *)(LPCTSTR)sFilename,SPIF_UPDATEINIFILE+SPIF_SENDC HANGE) != 0)
{
return 0;
}
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
strError.Format("SystemParametersInfo() failed with a return of %s", lpMsgBuf);
// Free the buffer.
LocalFree( lpMsgBuf );
}
lua_error(m_pState, strError);
return 0;
}
Promixis
May 25th, 2005, 10:29 AM
done for next release
Mark F
May 25th, 2005, 10:58 AM
You mean people actually used that function?? :)
Nice guy. ;)
Promixis
May 25th, 2005, 11:23 AM
:D
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.