Archive

Posts Tagged ‘GetSystemMetrics’

Get my system’s boot mode, or is my system booted in safe mode?

November 21, 2008 Leave a comment

Use GetSystemMetrics( SM_CLEANBOOT ), here are some inline functions, you can understand what they do from their names…

__inline BOOL IsNormalBoot()
{
    return ::GetSystemMetrics(SM_CLEANBOOT) == 0;
}

__inline BOOL IsSafeMode()
{
    return ::GetSystemMetrics(SM_CLEANBOOT) == 1;
}

__inline BOOL IsSafeModeWithNetworkBoot()
{
    return ::GetSystemMetrics(SM_CLEANBOOT) == 2;
}
Advertisements

How to find information about mouse?

November 19, 2008 Leave a comment

Well I’m not talking about the one that your cat runs after but the one on which your palm rests. 😉 It’s quite easy, use GetSystemMetrics and associated mouse indexes. I’ll show demos here…

Is there a mouse installed?

// Use GetSystemMetrics
::GetSystemMetrics( SM_MOUSEPRESENT );

Is there a mouse wheel present?

// Use GetSystemMetrics
// There is one more index present called SM_MOUSEHORIZONTALWHEELPRESENT, check out and tell me!
::GetSystemMetrics( SM_MOUSEWHEELPRESENT );

Count of mouse buttons?

// Use GetSystemMetrics
// You can also use this method to test presence of a mouse
::GetSystemMetrics( SM_CMOUSEBUTTONS );

Quite handy right? Most windows developers knows these but hey just in case you missed out. 😉

Connected to network!

Use any of these, but read the docs carefully before using them as they have some conditions associated with them…

IsNetworkAlive
IsDestinationReachable
RasEnumConnections
InternetGetConnectedState
InternetCheckConnection
GetSystemMetrics( SM_NETWORK ) //(Try this one, if your find issues tell me, I'm curious)

First one is the best so far if you have IE5 and later.

%d bloggers like this: