A way to check for Win98 or WinXP

This is a discussion on A way to check for Win98 or WinXP within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Yeah, I'm trying to think of a way to do this, and would appreciate any tips. I'm thinking that if ...

  1. #1
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    A way to check for Win98 or WinXP

    Yeah, I'm trying to think of a way to do this, and would appreciate any tips.

    I'm thinking that if 98 had a desktop.ini file, or similar, then I could just do something like:
    Code:
    int Check ( void )
    {
    	FILE Check;
    	if ( Check = fopen("c:/windows/desktop/desktop.ini", "r") == 1 )
    	{
    		/* 98 was not detected */
    		CreateDirectory("C:/documents and settings/all users/desktop/NewFolder", NULL);
    		/* etc.. */
    	}
    	else
    	{
    		/* 98 was deteced */
    		CreateDirectory("C:/windows/desktop/NewFolder", NULL);
    	}
    	return 0;
    }
    This is obviously targeted towards windows.

    Any tips?

    - edit -
    I have XP, and had 98, but couldn't remember these specifics.
    - edit -
    The world is waiting. I must leave you now.

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Code:
    #include <windows.h>
    bool Windows2000orXP()
    {
       return (GetVersion() bitand 0xFF)  == 5;
    }
    Last edited by Sang-drax; 10-30-2002 at 04:24 PM.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Mingw didn't like that code.
    You missed a parenthesis also..

    Thanks for the help, but I solved it.
    Last edited by Shadow; 10-30-2002 at 03:54 PM.
    The world is waiting. I must leave you now.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Mingw didn't like that code.
    It doesn't have to be best friends or even lovers with your code.
    If you really need it's appreciation, maybe you can talk about your problems. Talking always helps. Maybe Mingw can see what you see in this piece of code. Get a good cappucino and talk about your problems.

    OK, seriously, if it encountered errors, why not post them here ? For beginners replace the "bitand" part with a single ampersand ( & ) and see what happens.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    Just go into the command prompt and type "winver" or goto the start menu and select run and type "winver"

    [EDIT]
    Or do u want to do it with a program?
    [/EDIT]
    Last edited by biosninja; 10-31-2002 at 08:24 AM.

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    I got it solved.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. How can i check a directory for certain files?
    By patrioticpar883 in forum C++ Programming
    Replies: 13
    Last Post: 02-01-2008, 04:27 PM
  3. how to check input is decimal or not?
    By kalamram in forum C Programming
    Replies: 3
    Last Post: 08-31-2007, 07:07 PM
  4. Please check this loop
    By Daesom in forum C++ Programming
    Replies: 13
    Last Post: 11-02-2006, 12:52 AM
  5. check my code ( if statement, file existance )
    By Shadow in forum C Programming
    Replies: 1
    Last Post: 10-04-2001, 11:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21