Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

Screen Capture Frustration

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eddie Dunn - 17 Oct 2004 06:23 GMT
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
Herfried K. Wagner [MVP] - 17 Oct 2004 11:43 GMT
"Eddie Dunn" <ged6713@uncw.edu> schrieb:
> I am implementing a screen capture functionality into my Visual Basic
> .NET application.
[quoted text clipped - 18 lines]
> 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/samples/windowsandforms/downloads/Screens
hot.zip>

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

Eddie Dunn - 17 Oct 2004 16:59 GMT
> "Eddie Dunn" <ged6713@uncw.edu> schrieb:
> > I am implementing a screen capture functionality into my Visual Basic
[quoted text clipped - 24 lines]
> <URL:http://dotnet.mvps.org/dotnet/samples/windowsandforms/downloads/Screens
> hot.zip>

Thanks a million!  Works Perfectly

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.