CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2005
    Posts
    11

    Taking screenshot of IE

    Hi

    I want to take the screenshot of the web sites look in IE. The main challenge is to detect the IE in the screen and removing the unnecessary parts of it. For instance the screenshot should not contain start menu(easy part i think), any installed toolbars to IE and any borders.

    Any help will be appreciated

    Thanks,
    Batuhan Uslu

  2. #2
    Join Date
    Apr 2003
    Location
    Los Angeles area
    Posts
    776

    Re: Taking screenshot of IE

    You can use the java.awt.Robot class to get a screen shotof the desktop and process from there.
    "The Chicken and Rice MRE is not a personal lubricant."

  3. #3
    Join Date
    Oct 2005
    Posts
    11

    Re: Taking screenshot of IE

    The main point is not taking screenshot, detecting where ie is placed.. However i have somehow solved the detecting ie part with searching for a color match however it is not the best answer of this problem..

  4. #4
    Join Date
    Apr 2001
    Location
    South Africa, Jo'burg
    Posts
    680

    Re: Taking screenshot of IE

    Using the Robot class you can screen capture a given Rectangle. So if you can click the top left point of where you want the capture to be taken from and the bottom right point, then you can take those coordinates and build a Rectangle. Pass the Rectangle to Robot.createScreenCapture(Rectangle) and you will have a screen capture of all you want.

    Hope this helps
    Byron Tymvios

    Please use [ CODE ] and [/ CODE ] tags when posting code! See THIS on how to use code tags.

  5. #5
    Join Date
    Oct 2005
    Posts
    11

    Cool Re: Taking screenshot of IE

    However if we consider this operation will be done by an automation program things get worse

    By the way i've solved problem temporarly with detecting the pixel colors of ie and seems it worked. However it is not stable for now

    Anyway thanks...

  6. #6
    Join Date
    Apr 2001
    Location
    South Africa, Jo'burg
    Posts
    680

    Re: Taking screenshot of IE

    Have you considered hard coding the co-ordinates? It's not the cleanest method, but then neither is comparing pixels. If it's on the same machine, then the position of the bars in IE shouldn't change, so you can hard code them in and then use the aforementioned method.
    Byron Tymvios

    Please use [ CODE ] and [/ CODE ] tags when posting code! See THIS on how to use code tags.

  7. #7
    Join Date
    Apr 2006
    Location
    India
    Posts
    214

    Re: Taking screenshot of IE

    There must be windows commands to give you an applications window name and coordinates just search the windows help or docs. this would be much cleaner and reliable. You can then call em thru java and parse the input as per your need.

  8. #8
    Join Date
    Oct 2005
    Posts
    11

    Re: Taking screenshot of IE

    Quote Originally Posted by tbear
    There must be windows commands to give you an applications window name and coordinates just search the windows help or docs. this would be much cleaner and reliable. You can then call em thru java and parse the input as per your need.
    i tried to find those commands however i couldn't

  9. #9
    Join Date
    Oct 2005
    Posts
    11

    Re: Taking screenshot of IE

    Quote Originally Posted by Bnt
    Have you considered hard coding the co-ordinates? It's not the cleanest method, but then neither is comparing pixels. If it's on the same machine, then the position of the bars in IE shouldn't change, so you can hard code them in and then use the aforementioned method.

    Assume this system will test at least 10 hours, if there will be a 1 pixel movement at ie, whole test will fail, so think the thing that i'm trying to make is a emergency brake..

  10. #10
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Taking screenshot of IE

    Quote Originally Posted by batuj
    i tried to find those commands however i couldn't
    There are definitely Windows API methods that will return this information - however, you would need to access them via JNI.

    Don't tell people how to do things. Tell them what to do and let them surprise you with their results...
    G. Patton
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured