Note that there are some explanatory texts on larger screens.

plurals
  1. POScreen Capture (CopyFromScreen didn't work fully)
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/10233055/how-to-get-screenshot-to-include-the-invoking-window-on-xp">How to get screenshot to include the invoking window (on XP)</a> </p> </blockquote> <p>I'm currently using <code>CopyFromScreen(0, 0, 0, 0, imageSize)</code> to capture the desktop but unfortunately, there is a particular winform's contents which it didn't capture (the rest are alright). </p> <p>This winform's job is pretty simple; it's just a ticker program. Black background and a label that's moving per millisecond or so, that's all. No borders.</p> <p>I can't use directx's CaptureScreen (I've tried) because the graphic card's driver doesn't allow me to access the front buffer (there's nothing in the back buffer). I can't use <code>SendKey({PRTSC})</code> either because I can't overwrite the clipboard's content.</p> <p>What's interesting however, is that by pressing the keyboard's "Print Screen" and pasting it in MS Paint, the ticker program was captured perfectly. It just didn't work via <code>CopyFromScreen</code> in the code. How do I get it working, or is there any other workaround for this without resorting to win32 APIs?</p> <p><strong>EDIT:</strong></p> <p>I have discovered why didn't it work.</p> <p>It turns out that my ticker program's form had TransparentKey set to <em>anything other than null</em> (maroon in this case). When TransparentKey is <em>not null</em>, CopyFromScreen will not work. It just copies a blank image.</p> <p>Does anyone knows how to get both (TransparentKey and CopyFromScreen) working together? lol</p> <p><strong>EDIT 2 (SOLVED):</strong></p> <p>As posted below, I have discovered that CopyFromScreen is actually a wrapper around BitBlt. Instead of calling CopyFromScreen, I used the BitBlt call here: </p> <p><a href="https://stackoverflow.com/questions/158151/how-can-i-save-a-screenshot-directly-to-a-file-in-windows">How can I save a screenshot directly to a file in Windows?</a></p> <p>However, I modified the code a little. Change the call to: </p> <pre><code>WIN32_API.BitBlt(hMemDC, 0, 0,size.cx,size.cy, hDC, 0, 0, WIN32_API.SRCCOPY | WIN32_API.CAPTUREBLT); </code></pre> <p>And add this to WIN32_API class: </p> <pre><code>public const int CAPTUREBLT = 1073741824 </code></pre> <p>And now it's possible to capture desktop with TransparentKey. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload