Solved

Setting desktop pixel colors using Win API

Posted on 2009-05-06
10
235 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:secondeff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 23

Expert Comment

by:debuggerau
ID: 24322829
are you using bit blit?
http://en.wikipedia.org/wiki/Bit_blit
0
 
LVL 1

Author Comment

by:secondeff
ID: 24322870
Thanks for the response. I'm using bit blit to get the screen information. I'm using setpixel to write to it.
0
 
LVL 23

Expert Comment

by:debuggerau
ID: 24322924
ok, so you want to write on the screen, but have printscreens ignore the added layer?
0
Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

 
LVL 23

Expert Comment

by:debuggerau
ID: 24322982
goto go, but it cant be done without control of the computer....
back tomorrow...
0
 
LVL 1

Author Comment

by:secondeff
ID: 24323070
Yea, you summed it it. What do you mean "without control of the computer"? I'm writing the software for my own computer.
0
 
LVL 23

Expert Comment

by:debuggerau
ID: 24331929
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.
0
 
LVL 1

Author Comment

by:secondeff
ID: 24332275
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
0
 
LVL 23

Expert Comment

by:debuggerau
ID: 24332394
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:

http://www.faqs.org/faqs/msdos-programmer-faq/part2/section-17.html

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;
   }

0
 
LVL 1

Author Comment

by:secondeff
ID: 24332536
I tried the code snippet you posted and when I try to write to 0040:0100 I get an access violation.
0
 
LVL 23

Accepted Solution

by:
debuggerau earned 500 total points
ID: 24332970
yea, ok, its a DOS function, protected from windows.

So looking at other solutions, this came up:
http://labnol.blogspot.com/2004/08/disable-print-screen-key-in-windows.html
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?
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction In a previous article (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_6537-PaperPort-Upgrade-How-to-download-and-install-updated-versions-of-PaperPort-11-and-12.html) (now deprecated), I discussed how to upgrad…
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
The goal of the tutorial is to teach the user how to add a water mark to there photo. Once you have a photo you like you have to go into the water mark setting and add a water mark to the image. You can either choose a text watermark or an image…
The goal of the tutorial is to teach the user how to import photos into Adobe Lightroom efficiently and to keep everything organized.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question