Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:03:40+00:00 2026-05-23T10:03:40+00:00

in Windows XP, C programming language I want to read a pixel of the

  • 0

in Windows XP, C programming language

I want to read a pixel of the screen(i.e. 1024*768 which you can see now) in fast way

I think the framebuffer is the solution.

so

I tried

#include "SDL.h"
#include <stdio.h>
#include <time.h>

SDL_Surface *screen;

int main(int argc, char *argv[])
{
  if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) 
  {
    fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
    exit(1);
  }
  screen = SDL_GetVideoSurface();
  if ( screen == NULL ) 
  {
    exit(1);
  }

  return 0;
}

but the screen seems NULL

sorry for newb question

but could somebody let me know how to access framebuffer for reading a pixel?

any possible ways are welcome

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:03:40+00:00Added an answer on May 23, 2026 at 10:03 am

    SDL doesn’t let you read the pixels of the desktop. It abstracts away those features since they are non-portable (for example, what would it mean on a console or embedded device to read a desktop pixel?) As a result, you will need to use the Windows API directly. It has been a while since I’ve used windows, but at least a couple of years ago the process worked something like this:

    1. Get the desktop device context.

    2. Read the pixel from that.

    For example, the code might look something like this (again roughly speaking, I don’t use windows any more so I am not 100% here):

     HDC desktopDC = CreateDCAsNull("DISPLAY", NULL, NULL, NULL);
     int pixel=GetPixel(desktopDC, x, y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which programming language(s) were used to code Windows Vista?
In Windows, I am looking at generating professional graphs using any mainstream programming language
I have used just Windows for programming so far. Now, I have an internship
I'd like to know which method is recommended on Windows C programming: using malloc
I've done quite a bit of programming on Windows but now I have to
I want to create a software which windows will detect it as a installed
I am using python programming language,I want to join to wav file one at
Say I want to create a source code editor for ocaml programming language, where
I'm want to learn a desktop programming language, preferably C, C++ or C#. I'm
Sometimes, I want to write an simple application which will works on any Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.