Thread: setting a single pixel

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    596

    setting a single pixel

    Which GDI function is best for, or commonly used for setting a single pixel?

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    SetPixel works well.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    69

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Thanks. I see it is a bitmap function.

    I have been unable to search at msdn for some reason.

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by megafiddle View Post
    Thanks. I see it is a bitmap function.

    I have been unable to search at msdn for some reason.
    I don't know why that might be.
    It might help if you register (??).

    You might consider downloading the Platform SDK.
    It has all the answers, as well.

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    That could be it. I never registered, as I have been able to access everything.
    I can see the lessons, look at all the functions, download stuff, etc.

    Also I just tried using bing directly from bing.com (searched "msdn setpixel")
    and found the msdn page for the function immediately.
    Just doesn't work from within the msdn site. Or is there another search at
    the msdn site?

    It looks like the SDK is for Vista and later, though? I am using XP.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    It looks like the SDK is for Vista and later, though? I am using XP.
    Don't let that stop you. Each function is indexed by operating system version, library, header and dll support... Just don't be using anything newer than XP...

    Matter of fact, I work on Win7 (not by choice!) and still write for win2000 whenever possible. Backwards compatibility does matter.

  8. #8
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by CommonTater View Post
    Don't let that stop you. Each function is indexed by operating system version, library, header and dll support... Just don't be using anything newer than XP...

    Matter of fact, I work on Win7 (not by choice!) and still write for win2000 whenever possible. Backwards compatibility does matter.
    True.
    I have SDKs for 2003,..,2008 and they are pretty much the same, except where they are noted.
    I too am using XP.

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Steve A. View Post
    True.
    I have SDKs for 2003,..,2008 and they are pretty much the same, except where they are noted.
    I too am using XP.
    That's it... all you do is check which OS versions a given API call is supported on and it's all good.

    If you are forced to do something where you have to specify "Minimum Operating System" requirements it's easy enough to test for them...

    The following tests for XP-SP2....
    Code:
    // handle versioning
    VOID CheckWindowsVersion(void)
      { OSVERSIONINFOEX os = {0}; // version information
        DWORDLONG       cm = 0;   // conditioning value
        // precondition struct
        os.dwOSVersionInfoSize = sizeof(os);
        os.dwMajorVersion     = 5;
        os.dwMinorVersion     = 1;
        os.wServicePackMajor  = 2;    
        // condition the results
        VER_SET_CONDITION(cm,VER_MAJORVERSION,VER_GREATER_EQUAL);
        VER_SET_CONDITION(cm,VER_MINORVERSION,VER_GREATER_EQUAL);
        VER_SET_CONDITION(cm,VER_SERVICEPACKMAJOR,VER_GREATER_EQUAL);
        // exit on older versions
        if (!VerifyVersionInfo(&os,VER_MAJORVERSION | VER_MINORVERSION |
                          VER_SERVICEPACKMAJOR,cm))
          ReportError(20020,TRUE); }
    Last edited by CommonTater; 03-24-2011 at 10:41 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Single Entry Single Exit
    By robwhit in forum C Programming
    Replies: 5
    Last Post: 11-11-2007, 01:34 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. concatenating single chars to multi char arrays
    By TJJ in forum C Programming
    Replies: 7
    Last Post: 11-20-2003, 04:09 AM
  4. fancy strcpy
    By heat511 in forum C++ Programming
    Replies: 34
    Last Post: 05-01-2002, 04:29 PM
  5. Green Pixel On My Screen???
    By (TNT) in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 01-21-2002, 08:09 AM