PDA

View Full Version : Function: IsRunningOnTabletPC


Ted Sullivan
09-17-2004, 02:12 PM
Function: IsRunningOnTabletPC
Last Revision: September 17, 2004 (001)

Information
This function can be used to determine if the host operating system is running Window XP Tablet PC Edition.

To use this function in your Setup Factory 7.0 projects, simply copy and paste it into your Global Functions. You can get there by selecting Resources > Global Functions from the main menu.


function IsRunningOnTabletPC()
local strRet = DLL.CallFunction(_SystemFolder.."\\user32.dll","GetSystemMetrics",86,DLL_RETURN_TYPE_INTEGER,DLL_CALL_STDCALL);
local nLastError = Application.GetLastError();
if(nLastError == 0) then
if(strRet ~= "0") then
return true;
end
end
return false;
end


To call the function from your project, try copying and pasting the following script onto an action tab, such as the On Startup event. You can get there by choosing Project > Actions.

if (IsRunningOnTabletPC()) then
Dialog.Message("Status","This system is running Windows XP Tablet PC Edition");
else
Dialog.Message("Status","This system is NOT running Windows XP Tablet PC Edition");
end


Function Name: IsRunningOnTabletPC
Type: Setup Factory 7.0 Function
Created By: Brett Kapilik

Comments? Please post them here.

Eagle
01-30-2006, 08:59 AM
Here is a small modification to Brett's Code,
it allows for additional Os version detection:

"Windows XP Media Center Edition"
"Windows Server 2003 - Revision 2"

function IsRunningOnTargetPC(ntype)
local strRet = DLL.CallFunction(_SystemFolder.."\\user32.dll","GetSystemMetrics",ntype,DLL_RETURN_TYPE_INTEGER,DLL_CALL_STDCALL);
local nLastError = Application.GetLastError();
if(nLastError == 0) then
if(strRet ~= "0") then
return true;
end
end
return false;
end


--[[Set your additional Os targets to detect(uncomment only, your target OS code line)]]

local ntype = 86; local strOs = "Windows XP Tablet PC Edition";
--local ntype = 87; local strOs = "Windows XP Media Center Edition";
--local ntype = 89; local strOs = "Windows Server 2003 - Revision 2";

if (IsRunningOnTargetPC(ntype)) then
Dialog.Message("Status","This system is running "..strOs);
else
Dialog.Message("Status","This system is NOT running "..strOs);
end

Eagle
06-19-2006, 12:04 PM
Caution: testing at my end on Vista Beta 2(ultimate edition),

if you apply tests for:
--local ntype = 86; local strOs = "Windows XP Tablet PC Edition";
--local ntype = 87; local strOs = "Windows XP Media Center Edition";

you will find that results are 'true' for vista - ultimate edition
as functionality for both is imbedded for vista -ultimate

just a heads up for now, if developing for NT6

Tek
06-19-2006, 01:20 PM
Thanks for the example Ted!

On a side note, has anyone got a list of all the known values for 'ntype' and their associated operating system string values?

Eagle
06-24-2006, 10:46 PM
Correction for applying tests on Vista - Ultimate.

"Tablet Pc Edition" is Not returned true for this Os,
however the below has been reverified:

if you apply a test for:
--local ntype = 87; local strOs = "Windows XP Media Center Edition";

you will find that result is returned 'true' for Vista - Ultimate edition
as functionality for Media Center is imbedded for vista -ultimate

just a heads up for now, if developing for NT6