How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Window Capture Library

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Window Capture Library

    Hello everybody

    Window capture library will capture any window that is visible by providing the window handle.

    Functions:

    CaptureWindow // Capture window by specifying the window handle. Returns image filename.
    GetError // Get error.

    Here you can download the ams5 project.

    .Net 2.0 required.


    With Kind Regards

    sside
    Last edited by sside; 09-06-2006, 11:22 AM.

  • #2
    update

    Functions:

    CaptureWindow //Capture window by specifying a window handle. Will return the filename of the saved image file (jpeg format).
    CaptureWindowEx //Capture window by specifying window handle and a filename+imageformat. Formats supported: bmp, gif, jpeg, png.
    GetError // Get errors.

    The captured window will be saved as jpeg (standard by using CaptureWindow) or at your chosen format (by using CaptureWindowEx)

    Here you can download ams5 project.

    With Kind Regards

    sside

    Comment


    • #3
      WindowCapture.dll v.1.0.0.3

      Functions:
      GetFileName
      SetFileName //Set filename before capturing. If for example the filename is c:\image.jpeg the sequential captured images will be c:\image1.jpeg, c:\image2.jpeg etc etc.
      GetImageFile //Images are saved at the given location (SetFileName) but also in an inner list. GetImageFile retrives the image filename in that lists and removes it from the list.
      CaptureFromHwnd //Capture window from window handle.
      CaptureRectangle //Capture any part of the screen by providing the rectangle (x, y, width, height).
      CaptureScreen //Capture all screen.
      CaptureWindow //Shows an movable, sizable capture "window" (window border to be exactly). Click ctrl+c while the window has focus to capture.
      CaptureStart //Dynamic capture mode. Every window upon which the mouse rests/hoovers/moves will be visibly highlighted and surrounded with a green border. The highlighted window is a target to be captured. Press ctrl+c to capture.
      CaptureStop //Stop dynamic capture mode.
      GetError

      Formats supported are:
      Bmp
      Gif
      Jpeg
      Png

      To edit captured images or to print the visit this post:
      http://indigorose.com/forums/showthread.php?t=18217 (ImageEdit.dll, Print.dll).

      Download:
      WindowCapture.v.1.0.0.3.apz

      .Net 2.0 required.

      With Kind Regards
      sside
      Last edited by sside; 04-10-2007, 05:55 PM.

      Comment


      • #4
        WindowCapture Library (v.1.0.0.4)

        Functions:
        1. GetFileName
        2. SetFileName
        3. GetImageFile
        4. CaptureFromHwnd
        5. CaptureRectangle
        6. CaptureScreen
        7. CaptureWindowOpen
        8. CaptureWindowClose
        9. CaptureHighlightedWindowStart
        10. CaptureHighlightedWindowStop
        11. CaptureFromPrtScrStart
        12. CaptureFromPrtScrStop
        13. GetError
        .Net 2.0 required.

        With Kind Regards
        sside

        Comment


        • #5
          DLL: Rectangle Capture

          Tried to use the function for Rectangle Capture, but it just doesn't work. I do have .NET 2.0 SP1, and somehow the DLL can't load the captured image (if it captures it at all). I even tried to replace your ".jpeg" extention by the standard ".jpg", but it didn't work. BTW, where are the images saved to? I mean, the function returns just a string like "Image1.jpeg", "Image2.jpeg" etc, but how do I know where to take the captures from?

          Here's my piece of code:

          ----------------------------------------------------------------------------
          rawfile = WindowCapture.CaptureRectangle(12, 12, 101, 79); -- return DLL.CallFunction("AutoPlay\\Docs\\WindowCapture.dl l", "CaptureRectangle", x..","..y..","..width..","..height, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
          Image.Load("The_Image", AmendRaw(rawfile));

          -- IN GLOBALS --

          function AmendRaw(rawfile)

          fileName_t = String.SplitPath(rawfile);
          fileName_e = fileName_t.Filename;
          fileName_new = fileName_e..".jpg";

          return fileName_new

          end
          ----------------------------------------------------------------------------

          Thank you!
          Last edited by S0mbre; 02-28-2008, 01:02 AM.

          Comment


          • #6
            Are you having touble with the uploaded project (WindowCapture.v.1.0.0.4.apz) or have you modified the code and it doesn't work as expected?

            Try this:

            Code:
            fileName = WindowCapture.CaptureRectangle(0, 0, 400, 300);
            Image.Load("Image1", fileName);
            The images are saved at temp folder.

            The code at globals doesn't make any sense. You are modifying a string and not the filename. If you are trying to move or to rename the image file use File.Copy, File.Move, File.Rename etc.

            CaptureFromHwnd, CaptureRectangle, CaptureScreen will return the captured image filename. These functions are straight forward. Just load the image filename that the functions return in a image object and that's it.

            CaptureWindowOpen, CaptureHighlightedWindowStart, CaptureFromPrtScrStart will return nothing because need user interaction. You must specify an image filename first using SetFileName. If you specify image.jpeg as file name the captured image will be saved as jpeg. But if you specify image.png as filename the captured image will be saved as png. Formats supported are: bmp, gif, jpeg, png. The captured image will be stored in an internal list. Use GetImageFile to get the captured image file.

            When using SetFileName specify the full path + filename.

            Code:
            SetFileName("C:\\Images\\image.jpg");
            You must take a look at the project that i have uploaded (WindowCapture.v.1.0.0.4.apz). It should be clear.

            With Kind Regards
            sside
            Last edited by sside; 02-28-2008, 02:12 PM.

            Comment


            • #7
              sside, I am sorry to say, the DLL doesn't seem to capture anything. I've been using the simple code:

              fName = WindowCapture.CaptureRectangle(10, 10, 100, 100);
              Image.Load("Pic_1", fName);

              ...but could never see the capture shot inside "Pic_1". Can you tell me the folder name where the function saves the captured files to?

              Comment


              • #8
                Few questions:
                1. What is your os?
                2. The dll call is the return type set to DLL_RETURN_TYPE_STRING?
                3. What is the dll call, is it DLL_CALL_STDCALL or something else?
                4. What do you see if you do this?
                  Code:
                  fileName = WindowCapture.CaptureRectangle(0, 0, 400, 300);
                  Dialog.Message("FileName", fileName, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                5. Do you have any problem with the rest of the functions?
                6. Can you test it at another computer where .net 2.0 (without sp1) is installed?
                7. Can you post a simple project (.apz) that i can test it?
                The files are saved in the temp folder.
                It is tested in win xp pro and vista.

                With Kind Regards
                sside

                Comment


                • #9
                  Answers

                  1. OS is Win XP Professional SP2

                  2. The DLL code is yours:

                  function WindowCapture.CaptureRectangle(x, y, width, height)
                  return DLL.CallFunction("AutoPlay\\Docs\\WindowCapture.dl l", "CaptureRectangle", x..","..y..","..width..","..height, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
                  end
                  3. If you try to Dialog.Message the return string, it comes up with nothing, i.e. empty string.

                  4. Of all the functions only the "From HWND", and "Screen" seem to work. In the APZ you included with your post, the "Rectangle" function indeed comes up with the new capture filename like "Image1", "Image2" etc. but doesn't load the captured image into the form.

                  Maybe the temp folder on my computer is different?

                  My sample: Sample_SShot.apz

                  Thank you!

                  Comment


                  • #10
                    My bad. It was long time ago i wrote this dll and i had to open the project files to refresh my memory.

                    The above explanation needs a little bit correction.

                    Form this:
                    Code:
                    fileName = WindowCapture.CaptureRectangle(0, 0, 400, 300);
                    Image.Load("Image1", fileName);
                    to this:
                    Code:
                    WindowCapture.SetFileName("c:\\image.jpg");
                    fileName = WindowCapture.CaptureRectangle(0, 0, 400, 300);
                    Image.Load("Image1", fileName);
                    If you use:
                    Code:
                    WindowCapture.SetFileName("image.jpg");
                    the image will be saved where the exe is.

                    Again, the uploaded example (WindowCapture.v.1.0.0.4.apz) should work as expected. You can see that on Page OnShow SetFileName is the first function being called.

                    With Kind Regards
                    sside

                    Comment


                    • #11
                      Thank you! I was actually thinking (intuitively) of placing SetFileName before the capture function, but you are just quicker with the reply! :yes

                      Comment


                      • #12
                        WindowCapture Library (v.1.0.0.7)

                        Functions:
                        1. CaptureFromHwnd
                        2. CaptureRectangle
                        3. CaptureScreen
                        4. CaptureFromProcessId
                        5. CaptureFromProcessName
                        6. CaptureWindowOpen
                        7. CaptureWindowClose
                        8. CaptureHighlightedWindowStart
                        9. CaptureHighlightedWindowStop
                        10. CaptureFromPrtScrStart
                        11. CaptureFromPrtScrStop
                        12. GetImageCount
                        13. SaveImage
                        14. GetError
                        New:
                        1. CaptureFromProcessId
                        2. CaptureFromProcessName
                        3. GetImageCount
                        4. SaveImage
                        Note:
                        The .dll keeps the captured images in an internal queue (memory). Use GetImageCount to get the captured image nr. Use SaveImage to save the image (you can specify filename and format). Formats supported: bmp, gif, jpeg, png, tif.

                        .Net 2.0 required.

                        With Kind Regards
                        sside

                        Comment


                        • #13
                          Very nice additions. Thank you.
                          Dermot

                          I am so out of here :yes

                          Comment


                          • #14
                            when I specify a path for saveimage -- it doesn't save and no error is generated.

                            is there a way to specify a path for the save image?

                            Comment


                            • #15
                              As near as I can tell, it is working -- except that it keeps a file handle open for some reason -- at least on vista... Moving on to other methods....

                              Comment

                              Working...
                              X