473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Screen Capture Frustration

I have one here that I cannot find anything on in my searching.

I am implementing a screen capture functionality into my Visual Basic
..NET application.

The code I am using calls the bitblt function in gdi32.dll to achieve
its magic as follows:

Public Function CreateScreenshot() As Bitmap

Dim Rect As Rectangle = Screen.PrimaryScreen.Bounds
Dim gDest As Graphics
Dim hdcDest, hdcSrc As IntPtr

CreateScreenshot = New Bitmap(Rect.Right, Rect.Bottom)
gDest = gDest.FromImage(CreateScreenshot)

hdcSrc = GetDC(IntPtr.Zero)
hdcDest = gDest.GetHdc
BitBlt(hdcDest, 0, 0, _
Rect.Right, Rect.Bottom, hdcSrc, 0, 0, SRCCOPY)
gDest.ReleaseHdc(hdcDest)
ReleaseDC(IntPtr.Zero, hdcSrc)

End Function
This code works marvelously HOWEVER.....

This screen capture needs to capture my form (which is opaque) ontop
another form.

I have found that when the opacity for the topmost form is set less
than 100 % it does not show up in my capture.

The interesting thing is that a Ctrl-Alt-Print Screen yields the
opaque form in the resulting capture perfectly.

I have some ideas as to why this might be occuring ( gdi functions not
supporting nifty rendering features like opacity being at the top)

Nothing I have come up with at this point (and my skill levels) lead
me to any obvious solutions

I would rather not use Sendkeys and the clipboard as I feel that this
is shoddy at best.

Anybody have any ideas?
Thanks In Advance

Eddie
Nov 21 '05 #1
2 2178
"Eddie Dunn" <ge*****@uncw.edu> schrieb:
I am implementing a screen capture functionality into my Visual Basic
.NET application.

The code I am using calls the bitblt function in gdi32.dll to achieve
its magic as follows:
[...]
This code works marvelously HOWEVER.....

This screen capture needs to capture my form (which is opaque) ontop
another form.

I have found that when the opacity for the topmost form is set less
than 100 % it does not show up in my capture.

The interesting thing is that a Ctrl-Alt-Print Screen yields the
opaque form in the resulting capture perfectly.

I have some ideas as to why this might be occuring ( gdi functions not
supporting nifty rendering features like opacity being at the top)

Nothing I have come up with at this point (and my skill levels) lead
me to any obvious solutions


Try this sample:

<URL:http://dotnet.mvps.org/dotnet/sample...nloads/Screens
hot.zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:<uU*************@TK2MSFTNGP10.phx.gbl>...
"Eddie Dunn" <ge*****@uncw.edu> schrieb:
I am implementing a screen capture functionality into my Visual Basic
.NET application.

The code I am using calls the bitblt function in gdi32.dll to achieve
its magic as follows:
[...]
This code works marvelously HOWEVER.....

This screen capture needs to capture my form (which is opaque) ontop
another form.

I have found that when the opacity for the topmost form is set less
than 100 % it does not show up in my capture.

The interesting thing is that a Ctrl-Alt-Print Screen yields the
opaque form in the resulting capture perfectly.

I have some ideas as to why this might be occuring ( gdi functions not
supporting nifty rendering features like opacity being at the top)

Nothing I have come up with at this point (and my skill levels) lead
me to any obvious solutions


Try this sample:

<URL:http://dotnet.mvps.org/dotnet/sample...nloads/Screens
hot.zip>


Thanks a million! Works Perfectly
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
1
by: xc | last post by:
Greetings. I encountered a wield problem when grabing screen images. Sometimes in some computers I can capture the screen, but other times not so. In some computer I cannot capture the screen...
3
by: Per | last post by:
Hi all, This may be a newbie question, but I can't find the answer anywhere. I want to make a capture of the screen, or a part of the screen, that contains the main portion of the form. Detecting...
1
by: Jody Gelowitz | last post by:
I have seen some examples of how to capture a color from a point on screen using C#, but haven't come across anything with VB.NET. Is this possible under VB.NET? I know that I will need to use...
2
by: py | last post by:
I need to take a screen shot of the computer screen. I am trying to use PIL and I saw there is ImageGrab...however it only works on Windows. Is there a platform-independent ability to work...
4
by: gwhite1 | last post by:
I use this code to capture a screen in a regular VB 2005 windows app. It works great! I found the code in google. But when I create a windows service it does not capture the screen. It only...
2
by: dumbledad | last post by:
Hi All, I'm using ASP.Net web services to provide the logic required for a Flash based prototype. The Flash and the ASP .Net run together on the client machine. One of the functions I'd like to...
4
by: Paolo Pantaleo | last post by:
Hi, I need to capture a screen snapshot in Linux. PIL has a module IageGrab, but in the free version it only works under Windows. Is there any package to capture the screen on Linux? Thnx...
5
Atran
by: Atran | last post by:
Hello Everyone. In this article: You will know to capture the screen in 2 ways: 1)- Capture full screen. 2)- Capture region. Let's Begin: First make a new Windows Application project. And...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.