SourceForge.net Logo

Support This Project


  g    CaptureDll .

C:/Program Files>API.exe
For those of you that do not need the basics you probably can skip the first couple of paragraphs.
Ok I am going to start with the functions in order of use as close as possible first of all you have to include the header file some thing like.
#include "CaptureDll.h"
Also you will have to have the library for the linker CaptureDll.lib or libCaptureDll.a depending on which compiler / linker you use.
And then you have to do a little line of code like this. Using the class name.
CaptureDll *myDll = new CaptureDll();
And now we are ready to start with the function usage.
BOOL DllInit(HWND phwnd);
The above Dll call is optional all it does is set some values and save the handle to you program window for error messages. The values it set just need to be set to avoid errors. You will probably wish to reset the values you self.
BOOL Debug(int in);
Debug 1 for true 0 for false cause the dll to show a message box with the error box if it is true or 1 if it is false it will just return a false or NULL.
BOOL SetImageType(int in);
Here you have several types to chose from here is a list

1.  IM_JPEG_HI      :  .jpg image 100% quality.
2.  IM_JPEG_MED     :  .jpg image 75% quality.
3.  IM_JPEG_LOW     :  .jpg image 50% quality.
4.  IM_JPEG_LLOW    :  .jpg image 20% quality.
5.  IM_BMP_16       :   bitmap image with a bit depth of 16
6.  IM_BMP_24       :   bitmap image with a bit depth of 24
7.  IM_BMP_32       :   bitmap image with a bit depth of 32
BOOL SetFileName(TCHAR *filename);
Can be pretty much whatever you wish but if you select a somename.jpg and set the image type to bitmap you get a bitmap image with a jpg name!
BOOL SetCanvasSize(POINTXY &pt);
SetCanvasSize(POINTXY &pt); is the size of your photo. After the first image is taken you can not be reset until you call SaveImage() . POINTXY is defined in CaptureDll.h as two short int one height the other width. There is and example of the struct usage on my example page.
BOOL SetSnapShotSize(POINTXY &pt);
This one is reasonable self explained. It can be reset at any time but should not be larger than the canvas size.
BOOL SetSnapPosition(POINTXY &pt);
Now this is were it gets a little hard to explain. This dll call sets the position of the captured image on the window such as desktop values of 0 , 0 would be the top right hand corner and changing them to 100 , 100 would be 100 pixels down and 100 pixels left of that corner. If you move past the window you are trying to capture your image will be of what ever is on the screen at that point. You always capture the entire desktop then clip out what you do not want.
BOOL SetBackPosition(POINTXY &pt);
This is the position on the canvas that wish to place the image if moved out of range of the canvas then nothing will be placed on the canvas.
BOOL CaptureFullWindow(HWND in);
and
BOOL CaptureWindow(HWND in);
These two calls make capturing a window a lot easier. You just need to pass them a window handle or HWND and they do all the setting for you of course you can set and move to capture any part you wish.
BOOL CaptureImage(VOID);
CaptureImage Takes the first image sets the canvas size and must be called before AddImage.
BOOL AddImage(VOID);
AddImage can be call many times between AddImage and moving the position and size and the Background very creative captures can be made. Even things like entire windows that do not fit on the desktop if you can move the window and take another shot.
BOOL SaveImage(VOID);
After all is done call save image and your done. And now you can chose a new canvas size
HBITMAP GetDllBitmap(VOID);
And
int GetDllImageWidth(VOID);
int GetDllImageHeight(VOID);
BOOL SetDllHook()
Activates a Global Hook it is importain to unset the hook when finished with UnSetGlobleHook() it returns to your main winprocc call back UWM_MOUSEMOVE and then use switch(wParam) to use WM_LBUTTONDOWN,WM_MOUSEWHEEL,WM_RBUTTONDOWN,WM_LBUTTONUP,WM_RBUTTONUP to retrieve the mouse position use POINTXY * po; po = (POINTXY *)lParam; Hope This Help A full example is in the scriptable GUI available in the download section

BOOL UnSetDllHook()
This make it possible to preview the image before it is saved. GetDllImage width and height make it a little easier to do so.
All the GetImageSize and so forth should be easy to figure out I just wanted to leave you know that they are there.