|
Hi;
I would like to use your dll in my C# application. But when I try to import the dll an error apears.
Could you please help me on this.
Thanks
Hadi
|
|
|
|
|
Any one have SnaperHelper.dll's source code please send it to me.
thanks.
my e-mail : hotsyc0101@hotmail.com
|
|
|
|
|
If I have a machine with no sessions, but jobs are running, will your program be able to capture the screen shot .
I want to manage remote machines, which send a screen shot of their screens every 15 seconds. That I can find out if any error message has popped up on any of the machines.
|
|
|
|
|
Please help , I would desperately appreciate it if you could send me
the source code for screencapture.dll , I am currently creating an application that requires the image from the desktop to be stored in a file.
The tears shed in vain
and the hatred and pain
will be nothing but dust
at the end of the day
|
|
|
|
|
I really don't know why this article is in the CODE project, if there is no CODE...
Use this, it's not perfect, but it's here!
<br />
<br />
<br />
public Image CaptureScreen() <br />
{<br />
return CaptureWindow( User32.GetDesktopWindow() );<br />
}<br />
public Image CaptureWindow(IntPtr handle)<br />
{<br />
IntPtr hdcSrc = User32.GetWindowDC(handle);<br />
User32.RECT windowRect = new User32.RECT();<br />
User32.GetWindowRect(handle,ref windowRect);<br />
int width = windowRect.right - windowRect.left;<br />
int height = windowRect.bottom - windowRect.top;<br />
IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc);<br />
IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,width,height); <br />
IntPtr hOld = GDI32.SelectObject(hdcDest,hBitmap);<br />
GDI32.BitBlt(hdcDest,0,0,width,height,hdcSrc,0,0,GDI32.SRCCOPY);<br />
GDI32.SelectObject(hdcDest,hOld);<br />
GDI32.DeleteDC(hdcDest);<br />
User32.ReleaseDC(handle,hdcSrc);<br />
Image img = Image.FromHbitmap(hBitmap);<br />
GDI32.DeleteObject(hBitmap);<br />
return img;<br />
}<br />
public void CaptureWindowToFile(IntPtr handle, string filename, ImageFormat format) <br />
{<br />
Image img = CaptureWindow(handle);<br />
img.Save(filename,format);<br />
}<br />
public void CaptureScreenToFile(string filename, ImageFormat format) <br />
{<br />
Image img = CaptureScreen();<br />
img.Save(filename,format);<br />
}<br />
<br />
private class GDI32<br />
{<br />
<br />
public const int SRCCOPY = 0x00CC0020;
[DllImport("gdi32.dll")]<br />
public static extern bool BitBlt(IntPtr hObject,int nXDest,int nYDest,<br />
int nWidth,int nHeight,IntPtr hObjectSource,<br />
int nXSrc,int nYSrc,int dwRop);<br />
[DllImport("gdi32.dll")]<br />
public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC,int nWidth, <br />
int nHeight);<br />
[DllImport("gdi32.dll")]<br />
public static extern IntPtr CreateCompatibleDC(IntPtr hDC);<br />
[DllImport("gdi32.dll")]<br />
public static extern bool DeleteDC(IntPtr hDC);<br />
[DllImport("gdi32.dll")]<br />
public static extern bool DeleteObject(IntPtr hObject);<br />
[DllImport("gdi32.dll")]<br />
public static extern IntPtr SelectObject(IntPtr hDC,IntPtr hObject);<br />
}<br />
<br />
private class User32<br />
{<br />
[StructLayout(LayoutKind.Sequential)]<br />
public struct RECT<br />
{<br />
public int left;<br />
public int top;<br />
public int right;<br />
public int bottom;<br />
}<br />
[DllImport("user32.dll")]<br />
public static extern IntPtr GetDesktopWindow();<br />
[DllImport("user32.dll")]<br />
public static extern IntPtr GetWindowDC(IntPtr hWnd);<br />
[DllImport("user32.dll")]<br />
public static extern IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDC);<br />
[DllImport("user32.dll")]<br />
public static extern IntPtr GetWindowRect(IntPtr hWnd,ref RECT rect);<br />
}
|
|
|
|
|
Any one have SnaperHelper.dll's source code please send it to me.
thanks.
my e-mail : ayyagari_shankar@yahoo.com
shankar
|
|
|
|
|
please send me the souce code of the SnaperHelper.dll.
my e-mail : ayyagari_shankar@sify.com
shankar
|
|
|
|
|
hy,
Everybody,
Can it posible that capturing image of any application window
without displying it.I mean that application is running in backgroud that mean it`s window is hide,Now can i capture that
window which is hide? if yes then how?
|
|
|
|
|
|
Hello Everyone,
I was wondering what would be the best way to send a form to the printer.
I have a form the user fills in. Once they are done it needs to be printed. Is there a way to do a screen capture to a bitmap? Maybe I can then print the bitmap.
Thanks in Advance for any help.
|
|
|
|
|
|
Hi
First of all I was quite impressed of the interface of your source!
Nice work!
I just wanted to know one thing though..
Is it possible to fix the width while capturing? (something like region capturing, just that the mouse's width will be fixed after once clicking to make the square for capturing area)
I tried to add couple of functions but the DLL somehow seemed to do everything
so I couldn't get my hands into it
Could you pull me some hands out for me to do this job?
|
|
|
|
|
Hi Dany,
I have seen some anomalies in your code, if we run the multiple instances of this application then printscreen message dose not goto your application. Instead it goes to system directly.
I figure out that you are registering your own windows message "UWM_PRINTSCREEN", thats why it fails for other instances (while registering message).
Is there any work around to send printscreen message to application only, instead of system while the multiple instances of application are active.
Thank you,
Regards,
Vishal More
|
|
|
|
|
hum - they want the source
screen capture can be done using winAPI like this:
call GetDC(0) to get the screen dc where all is painted;
determine the rectangle size - by call to GetClientRect, with window handle from GetDesktopWindow();
CreateBitmap with the determined size; call BitBlt to copy to our bitmap from screen;
finally use ReleaseDc to free allocated DC;
sorry that i have no time to write it in C.
DLL will be needed if you want to hook keyboard clicks.
|
|
|
|
|
Hey, thanks! Here's what I wrote in Borland Delphi 7 based on your tips:
procedure TForm1.Button1Click(Sender: TObject);
var
hWndIE, AppDC: THandle;
Rect: TRect;
begin
hWndIE := FindWindow('IEFrame', nil); // http://delphi.about.com/library/weekly/aa060303b.htm
if hWndIE > 0 then
begin
try
Application.Minimize;
AppDC := GetWindowDC(hWndIE);
Windows.GetClientRect(hWndIE, Rect);
with Image.Picture.Bitmap do
begin
PixelFormat := pf32bit;
Height := Rect.Bottom - Rect.Top + 1;
Width := Rect.Right - Rect.Left + 1;
{thanks to http://www.swissdelphicenter.ch/torry/showcode.php?id=140}
BitBlt(Canvas.Handle, 0, 0, Width, Height, AppDC, 0, 0, SRCCOPY);
Modified := True;
end;
finally
ReleaseDC(0, hWndIE);
end;
Application.Restore;
end;
end;
|
|
|
|
|
HI
i used the gdi way to capture the screen. bu there seems to be some problems.
1) cursor is not captured.. if so how can i draw the cursor on the capture image...
2) i have form in C# whose Opacity=0.25 percent. and there are some writings on them... i could not cathc them also...
is there anywya to capture this thing also... i suppose they r like overlays..
ve
|
|
|
|
|
Well , thanks , but I'm coding in pure C using the
win32 api.
I have something that looks like this :
<br />
HBITMAP hbm;<br />
HDC screendc;<br />
HDC imagedc;<br />
int w;<br />
int h;<br />
<br />
int init(void)<br />
{<br />
screendc = GetDC(NULL);<br />
imagedc = CreateCompatibleDC(screendc);<br />
w = GetSystemMetrics(SM_CXSCREEN);<br />
h = GetSystemMetrics(SM_CYSCREEN);<br />
<br />
hbm = CreateCompatibleBitmap(imagedc,w,h);<br />
ReleaseDC(NULL,screendc);<br />
}<br />
<br />
void CaptureSave(LPSTR szFname)<br />
{<br />
SelectObject(imagedc,hbm);<br />
screendc = GetDC(NULL);<br />
BitBlt(imagedc,0,0,w,h,screendc,0,0,SRCCOPY);<br />
ReleaseDC(NULL,screendc);<br />
<br />
ConvertSaveDIB(szFname,hbm);<br />
}<br />
<br />
void ConvertSaveDIB(LPSTR fn,HBITMAP bm)<br />
{<br />
<br />
<br />
}<br />
The tears shed in vain
and the hatred and pain
will be nothing but dust
at the end of the day
|
|
|
|
|
Hi , I have a good way for you to get a hold of the screen.... :
this method has worked for me without fail , for more than a year now ,
and Im still waiting to find a pc that won't be able to perform this function
To use it simply add the forward declaration (prototype) at the top of your file :
int SnapShot(char* fname);
And then , when you want to use it , simply call it with a file name :
<br />
{<br />
SnapShot("img0.bmp");<br />
}<br />
<br />
int SnapShot(char* fname)<br />
{<br />
HBITMAP hdib;<br />
BITMAPINFO bi;<br />
BITMAPFILEHEADER bfh;<br />
void *bits;
bits=NULL;<br />
<br />
int WIDTH,HEIGHT,BPP;<br />
WIDTH = GetSystemMetrics(SM_CXSCREEN);<br />
HEIGHT=GetSystemMetrics(SM_CYSCREEN);<br />
BPP = 24; <br />
<br />
bi.bmiHeader.biSize = 40;<br />
bi.bmiHeader.biWidth = WIDTH;<br />
bi.bmiHeader.biHeight = HEIGHT;<br />
bi.bmiHeader.biPlanes = 1;<br />
bi.bmiHeader.biBitCount = BPP;<br />
bi.bmiHeader.biCompression = BI_RGB;<br />
bi.bmiHeader.biSizeImage = (BPP/8)*(WIDTH)*(HEIGHT);<br />
bi.bmiHeader.biXPelsPerMeter =0;<br />
bi.bmiHeader.biYPelsPerMeter =0;<br />
bi.bmiHeader.biClrUsed =0;<br />
bi.bmiHeader.biClrImportant =0;<br />
<br />
bfh.bfType = 0x4D42;<br />
bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);<br />
bfh.bfSize = bi.bmiHeader.biSizeImage+bfh.bfOffBits;<br />
bfh.bfReserved1 = 0;<br />
bfh.bfReserved2 = 0;<br />
<br />
HDC hdc = GetDCEx (hWnd,NULL, DCX_CACHE|DCX_LOCKWINDOWUPDATE) ;<br />
HDC fdc = CreateCompatibleDC(hdc);<br />
<br />
hdib = CreateDIBSection(fdc,&bi,DIB_RGB_COLORS,&bits,NULL,0);<br />
SelectObject(fdc,hdib);<br />
BitBlt(fdc,0,0,WIDTH,HEIGHT,hImgDC,0,0,SRCCOPY);<br />
ReleaseDC(hWnd,hdc); <br />
<br />
<br />
<br />
<br />
char firstpath[255];<br />
GetCurrentDirectory(255,firstpath);<br />
if(SetCurrentDirectory("SnapShots") == 0)<br />
CreateDirectory("SnapShots",NULL); <br />
SetCurrentDirectory(firstpath);<br />
<br />
char *tempbuffer=malloc(sizeof(char)*255);<br />
sprintf(tempbuffer,"%s\\SnapShots\\%s",firstpath,fname);<br />
<br />
MessageBox(NULL,tempbuffer,"Creating...",MB_OK);<br />
<br />
BOOL bSuccess = FALSE ;<br />
DWORD dwBytesWritten ;<br />
HANDLE hFile ;<br />
hFile = CreateFile (tempbuffer, GENERIC_WRITE,FILE_SHARE_WRITE, NULL,<br />
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ; <br />
if (hFile == INVALID_HANDLE_VALUE)<br />
return FALSE ;<br />
bSuccess = WriteFile (hFile,&bfh,sizeof(bfh), &dwBytesWritten, NULL) ;<br />
<br />
bSuccess = WriteFile (hFile,&bi.bmiHeader,sizeof(bi.bmiHeader), &dwBytesWritten, NULL) ;<br />
<br />
bSuccess = WriteFile (hFile,bits,bi.bmiHeader.biSizeImage, &dwBytesWritten, NULL) ;<br />
<br />
CloseHandle (hFile) ;<br />
DeleteDC(fdc);<br />
DeleteObject(hdib);<br />
free(tempbuffer);<br />
return TRUE;<br />
}<br />
The tears shed in vain
and the hatred and pain
will be nothing but dust
at the end of the day
|
|
|
|
|
Hey,
i only want to say that this works fine!
|
|
|
|
|
Hi,
How can we implement autoscroll feature on it?
I hate to use hypersnap..
|
|
|
|
|
Did Your project based on/inspired by this MSDN sample?
|
|
|
|
|
Very nice control, love the interface.
i was wondering if there's a way to caputre the coordinates of the selected region using your DLL?
I need to find out the x1, y1, x2, y2 coordinates of user selected area on the screen.
Also do you have an API to output the captured image to certain format?
Thanks a lot!!
Dave
|
|
|
|
|
Actually you cannot get the coordinates of selected region and no other image formats included.
For the coordinates, I will add CRect function to get the x1, y1, x2, y2 coordinates of user selected area on the screen ex: HBITMAP GetRegionImage(LPRECT lprc);
For captured image format, nothing new! Your app need to convert HBITMAP Handle to other image format.
===== Last week, one people offer me 1500$ US to have the source code and at this moment, I dont know if I will accept this offer. =====
->L'enfer est pavé de bonnes intentions! :-S
->The road to hell is paved with good intentions! :-S
|
|
|
|
|
Cool, thanks.
the CRect function is not currently available right?
any estimates on when?
|
|
|
|
|
This is a joke. If you dont want to share the .dll source you should post your program under some other topic such as "PictureBox with Scrollbars". This site is for sharing source code. What exactly was you looking in here? Admiration? Bleh...
|
|
|
|
|