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
|