Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137

    Check for Normal, Safe Modes!

    I posted this response in the Setup Factory 7.0's forum. It can be useful here in the AMS forums too. I had created a .exe to check for which mode a computer is in (normal, safe, safe with networking mode(s)). But, I took a couple minutes just now and realized the following code (or it seems, try it out and let us know) does the trick without an external .exe or .dll! (it uses the User32.dll windows has innate to itself).
    Code:
    dll_SystemMode = DLL.CallFunction("C:\\WINDOWS\\system32\\user32.dll", "GetSystemMetrics", "67", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
    
    Dialog.Message("", dll_SystemMode)
    Intrigued

  2. #2
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    just a minor more generic tweak...

    Code:
    dll_SystemMode = DLL.CallFunction(_SystemFolder.."\\user32.dll", "GetSystemMetrics", "67", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    
    Dialog.Message("", dll_SystemMode);

  3. #3
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Nice one you guys...

  4. #4
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    Just a bit of example usage code
    this example detects if in SafeMode
    and exits the Application if detected

    Code:
    function IsSafeMode()
    --safe mode return params(string form): 0 normal, 1 safemode-std, 2 safemode with network support
    bSafeMode = false;
    local n_SystemMode = DLL.CallFunction(_SystemFolder.."\\user32.dll", "GetSystemMetrics", "67", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    if (n_SystemMode ~= "") then
    	if (String.ToNumber(n_SystemMode) > 0) then
    	--use the below timed message if you wish		
    	Dialog.TimedMessage(" - Installation Startup Aborted: "..n_SystemMode, "This Program should Not be run while\r\n"
    	.."the System is in a ' SafeMode ' state.\r\nPlease run Program from Normal Bootup\r\n\r\n"
    	.."    - This Installer will now Exit ...", 10000, MB_ICONINFORMATION);
    	bSafeMode = true;
    	end
    end
    return bSafeMode;
    end
    
    --to Call it:
    
    if IsSafeMode() then
    --add what you wish to do here
    Application.Exit(0); --(this one exists the installer)
    end
    tested on Win2K-XP-W2K3 All versions and SPacks
    (should work for Win95,Win98-WinMe also)
    Last edited by Eagle; 11-10-2005 at 03:35 AM.

  5. #5
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Coo' update! I wish I had more time to code. But, I have way less time since moving and getting back to work. Boo'da'hoo hoo.

    Intrigued

Similar Threads

  1. DLL - Safe Mode check
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 9
    Last Post: 08-12-2005, 09:59 PM
  2. Check HTTP for file...
    By eleslie in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 05-15-2004, 12:21 PM
  3. Default check box value based on variable
    By Terry Rasmussen in forum Setup Factory 6.0
    Replies: 7
    Last Post: 02-27-2004, 02:08 PM
  4. "Safe Riched32.dll"
    By boneswareinc in forum Setup Factory 5.0
    Replies: 1
    Last Post: 01-22-2001, 03:27 PM
  5. check boxes
    By bzadik in forum AutoPlay Menu Studio 3.0
    Replies: 1
    Last Post: 06-06-2000, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts