RizlaUK
06-11-2007, 05:19 PM
This dll will enable you to set the users display settings to suit your app,
function name: ChangeDisplaySettings
Arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)
Returns:
0 = The settings change was successful.
1 = The computer must be restarted in order for the graphics mode to work.
-4 = An invalid set of flags was passed in.
-1 = The display driver failed the specified graphics mode.
-2 = The graphics mode is not supported.
-3 = Windows NT only: Unable to write settings to the registry.
i have set this into a easy to use function for apms, the function will resize the screen and reposition the app so its in the center
--Global function for the screen settings, !!!DO NOT EDIT!!!
function ChangeDisplaySettings(width,height,Depth,Freq,Perm anent)
args = width..", "..height..", "..Depth..", "..Freq..", "..Permanent
result = DLL.CallFunction("AutoPlay\\Docs\\DLLDisplaySettings.dll", "ChangeDisplaySettings", args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
if result == "0" then
local hWnd = Application.GetWndHandle();
local WndSize = Window.GetSize(hWnd);
local ScreenRes = System.GetDisplayInfo();
local NewPos_X = (ScreenRes.Width - WndSize.Width)/2;
local NewPos_Y = (ScreenRes.Height - WndSize.Height)/2;
Window.SetPos(hWnd, NewPos_X, NewPos_Y);
else
if result == 1 then err = "The computer must be restarted in order for the graphics mode to work"
elseif result == "-4" then err = "An invalid set of flags was passed in"
elseif result == "-1" then err = "The display driver failed the specified graphics mode"
elseif result == "-2" then err = "The graphics mode is not supported"
elseif result == "-3" then err = "Unable to write settings to the registry"
end
Dialog.Message("Error", err, MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
end
end
which would be called with this
-- arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)
ChangeDisplaySettings(800,600,16,70,0)
if you set permanent to false (0) then the users original settings will be restored when your app exits
you can download the amp example file (apz) or the dll and function in text file(zip)
function name: ChangeDisplaySettings
Arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)
Returns:
0 = The settings change was successful.
1 = The computer must be restarted in order for the graphics mode to work.
-4 = An invalid set of flags was passed in.
-1 = The display driver failed the specified graphics mode.
-2 = The graphics mode is not supported.
-3 = Windows NT only: Unable to write settings to the registry.
i have set this into a easy to use function for apms, the function will resize the screen and reposition the app so its in the center
--Global function for the screen settings, !!!DO NOT EDIT!!!
function ChangeDisplaySettings(width,height,Depth,Freq,Perm anent)
args = width..", "..height..", "..Depth..", "..Freq..", "..Permanent
result = DLL.CallFunction("AutoPlay\\Docs\\DLLDisplaySettings.dll", "ChangeDisplaySettings", args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
if result == "0" then
local hWnd = Application.GetWndHandle();
local WndSize = Window.GetSize(hWnd);
local ScreenRes = System.GetDisplayInfo();
local NewPos_X = (ScreenRes.Width - WndSize.Width)/2;
local NewPos_Y = (ScreenRes.Height - WndSize.Height)/2;
Window.SetPos(hWnd, NewPos_X, NewPos_Y);
else
if result == 1 then err = "The computer must be restarted in order for the graphics mode to work"
elseif result == "-4" then err = "An invalid set of flags was passed in"
elseif result == "-1" then err = "The display driver failed the specified graphics mode"
elseif result == "-2" then err = "The graphics mode is not supported"
elseif result == "-3" then err = "Unable to write settings to the registry"
end
Dialog.Message("Error", err, MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
end
end
which would be called with this
-- arguments: width, height, Depth, Freq, Permanent (0 false, 1 = true)
ChangeDisplaySettings(800,600,16,70,0)
if you set permanent to false (0) then the users original settings will be restored when your app exits
you can download the amp example file (apz) or the dll and function in text file(zip)