|
|
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...
|
|
|
|
|
Have you stolen the library from some other proejct. Can you post the link or refrance
In my openion the name of the project should be "Using a dll in VC and VB without my help"
Hardwork is key to success...
Bilal Ahmed
|
|
|
|
|
This library is my own A-Z work. Its free and have only 4 functions to call. Look in the demo to see how call theses functions. Very easy!!!
->L'enfer est pavé de bonnes intentions! :-S
->The road to hell is paved with good intentions! :-S
|
|
|
|
|
This tool is very slick & powerfull. I like it!
I did find one bug. I have a dual monitor setup here, and it only allows me to capture stuff from the primary monitor. Thanks.
|
|
|
|
|
I like it! Thanks!
==============================================
SkinMagic SDK Library for C/C++
The better solution for write skinnable application
http://www.appspeed.com
==============================================
|
|
|
|
|
Thank to you jedyking
->L'enfer est pavé de bonnes intentions! :-S
->The road to hell is paved with good intentions! :-S
|
|
|
|
|
please but the full source code or get away from the developers
Thanks and Best Regards,
Ahmed Ismaiel
sonork ID 100.11442
|
|
|
|
|
Yeahh, put the full source code!!!!!!
|
|
|
|
|
Actually, there is no *requirement* that he post his source code. However, since he didn't post his source code, his article is made that much less pertinent or useful.
All things considered, this article sucks.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Why the source code for SnaperHelper.dll is not included?
|
|
|
|
|
Hello,
I couldn't help noticing that the icon provided in the screen-shot is very similar to the one Hyper-Snap[^] is using. Do you work for Hyper Ionics and are making public a dll without providing the source code? Just curios.
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|