Detecting if OS is Windows???

This is a discussion on Detecting if OS is Windows??? within the Windows Programming forums, part of the Platform Specific Boards category; This may sound stupid but I do want to ask it to be sure. If you have a cross platform ...

  1. #1
    Registered User Ktulu's Avatar
    Join Date
    Oct 2006
    Posts
    62

    Question Detecting if OS is Windows???

    This may sound stupid but I do want to ask it to be sure.
    If you have a cross platform application which can run under a Windows OS and Mac OS, in example,
    is there a way to detect if that OS is a Windows OS and if it actually is a Windows OS, are you then able to use Windows code?
    This parameter is reserved

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Hi, this post may answer your question.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    http://predef.sourceforge.net/index.php
    You probably want some #if type stuff around the OS specific parts of your code.

    If you do it carefully, you should have
    win.cpp - all the windows specific code
    mac.cpp - all the mac specific code
    Both these files provide the same interface to
    main.cpp - all the independent code
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 02:36 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09:00 AM
  3. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  4. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM

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