Setting desktop pixel colors using Win API

Hi everyone. I am working on a project written using Windows API. The program currently captures the full screen (like printscreen) and draws new pixels to it without a problem.  I need to find a way to visibly set pixels on the screen but NOT change printscreen calls. Like two layers stacked on top of each other. The top layer being separate from the bottom.  My changes must only occur in the top layer. Is this possible? If so, I'm looking for the windows api functions that will work. Thanks a bunch.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

debuggerauConnect With a Mentor Commented:
yea, ok, its a DOS function, protected from windows.

So looking at other solutions, this came up:
It talks about reallocating predefined keys for printscrn..

But it also talks about limitation with it too, like how it will only capture the current screen..
Obviously it would be difficult to configure every system with a second screen, but I have written data to outside the current window, but it is not displayed, yet still accessible. Would this help do you think?
are you using bit blit?
secondeffAuthor Commented:
Thanks for the response. I'm using bit blit to get the screen information. I'm using setpixel to write to it.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

ok, so you want to write on the screen, but have printscreens ignore the added layer?
goto go, but it cant be done without control of the computer....
back tomorrow...
secondeffAuthor Commented:
Yea, you summed it it. What do you mean "without control of the computer"? I'm writing the software for my own computer.
you say that you don't want to change printscreen calls, however that feature will capture all layers onscreen, unless you disable that function while displaying your particulars.
secondeffAuthor Commented:
I'll concede that I can't draw on the desktop without it being captured. I could work around this if I knew when any program captured this data (maybe a windows hook)? I can monitor the printscreen key by re-registering its hotkey in my application. However, what happens in the case of a CreateDC("Display") call? How would I monitor this?- Thanks
a createDC call for the display would need a windows helper hook to override the call, but I think you'd be better off using this approach:

The standard handler, in BIOS versions dated
 December 1982 or later, uses a byte at 0040:0100 (= 0000:0500) to
 determine whether a print screen is currently in progress. If it is,
 pressing PrintScreen again is ignored. So to disable the screen
 snapshot, all you have to do is write a 1 to that byte. When the user
 presses PrintScreen, the BIOS will think that a print screen is already
 in progress and will ignore the user's keypress. You can re-enable
 PrintScreen by zeroing the same byte.

 Here's some simple code:

   void prtsc_allow(int allow) /* 0=disable, nonzero=enable */
     unsigned char far* flag = (unsigned char far*)0x00400100UL;
     *flag = (unsigned char)!allow;

secondeffAuthor Commented:
I tried the code snippet you posted and when I try to write to 0040:0100 I get an access violation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.