Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2007, 06:40 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Screan Capture Using Windows Services

Dear

Am running this code after import the User32.dll but it always return black Image


int hSDC, hMDC;
int hBMP, hBMPOld;
int r;
hSDC = CreateDC("DISPLAY", "", "", "");
hMDC = CreateCompatibleDC(hSDC);
FW = GetDeviceCaps(hSDC, 8);
FH = GetDeviceCaps(hSDC, 10);
hBMP = CreateCompatibleBitmap(hSDC, FW, FH);
hBMPOld = SelectObject(hMDC, hBMP);
r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, SRCCOPY);
hBMP = SelectObject(hMDC, hBMPOld);
r = DeleteDC(hSDC);
r = DeleteDC(hMDC);
System.Drawing.Bitmap ret = System.Drawing.Image.FromHbitmap(new IntPtr(hBMP));
DeleteObject(hBMP);
return ret;

Any sugesstions






Similar Threads
Thread Thread Starter Forum Replies Last Post
windows services rana018 C# 0 August 16th, 2006 05:13 AM
Windows services in C# arielote C# 1 December 27th, 2005 06:13 PM
windows services marclena General .NET 0 June 30th, 2004 11:22 AM
Windows Services rodmcleay General .NET 1 June 29th, 2004 01:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.