Jump to content

Incomplete screen capture


obrienj
 Share

Recommended Posts

I created a main GUI that contains 4 child, overlayed GUIs the first of which is a jpeg and the rest are transparent gif files. Together the 4 child GUIs make up a NOAA radar image.

If I do a _ScreenCapture_Screen I only get the main GUI and not the built-up radar image that sits on top of it.

However, if I do a "Print Screen" I get everything.

My intent is to capture the built-up image and manipulate it using GDI+ to produce a "zoomed" image covering a smaller geographic area covering the same display area.

I am at a bit of a loss as to why _ScreenCapture_Capture doesn't capture everything but "Print Screen" does.

But most important, is how do I make the _ScreenCapture_Capture work or a work-around.

Regards,

Jim

Link to comment
Share on other sites

I created a main GUI that contains 4 child, overlayed GUIs the first of which is a jpeg and the rest are transparent gif files. Together the 4 child GUIs make up a NOAA radar image.

If I do a _ScreenCapture_Screen I only get the main GUI and not the built-up radar image that sits on top of it.

However, if I do a "Print Screen" I get everything.

My intent is to capture the built-up image and manipulate it using GDI+ to produce a "zoomed" image covering a smaller geographic area covering the same display area.

I am at a bit of a loss as to why _ScreenCapture_Capture doesn't capture everything but "Print Screen" does.

But most important, is how do I make the _ScreenCapture_Capture work or a work-around.

Regards,

Jim

Maybe $WM_PRINT would work

Const $PRF_CHECKVISIBLE 0x00000001
Const $PRF_NONCLIENT    0x00000002
Const $PRF_CLIENT   0x00000004
Const $PRF_ERASEBKGND   0x00000008
Const $PRF_CHILDREN     0x00000010
Const $PRF_OWNED    0x00000020

_SendMessage($MyGui,$WM_PRINT,$hDC,BitOr($PRF_CHILDREN, $PRF_CLIENT))
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanubis,

Thanks for your example.

I tried it with some success but while it captured the main window, it only captured the first of the 4 transparent overlayed child GUIs but not the rest.

Yet, Print Screen captures all of the GUIs, main as well as the children.

Shouldn't ScreenCapture_Capture as well as your example which seems to be a derivative of _ScreenCapture_Capture capture everything associated with the parent window of which the 4 transparent overlayed GUIs are children?

What am I missing?

Regards,

Jim

Link to comment
Share on other sites

Thanubis,

Thanks for your example.

I tried it with some success but while it captured the main window, it only captured the first of the 4 transparent overlayed child GUIs but not the rest.

Yet, Print Screen captures all of the GUIs, main as well as the children.

Shouldn't ScreenCapture_Capture as well as your example which seems to be a derivative of _ScreenCapture_Capture capture everything associated with the parent window of which the 4 transparent overlayed GUIs are children?

What am I missing?

Regards,

Jim

Maybe you could

Winactivate your window

Send("!{PRINTSCREEN}");to capture just the active window

Then save the clipboard to a file. I don't know how to do that but I would think some _ClipBoard_GetDataEx type function should be possible.

This link might help.

As a quick test you could open Paint and send("^v") and save it to some file.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanubis,

The problem I am having can be shown with your latest example.

If you make all of the squares occupy the same coordinates (I used 10,10), you will notice that the first one defined is the only one captured as if the other three were never created.

If you move the first square to be defined last, then the one that was second (now first) becomes the one captured. Given this incomplete capture, I would have expected the last defined to be the one captured.

In my case, the final three GUIs are .gif files that are transparent except for the areas used (e.g., a radar precepitation image). Everything displays as I wish, "print Screen" captures everything, but your technique and ScreenCapture only capture the first child GUI defined.

No need to spend any more time on this unless, like me, you can't let something like this go. Unfortunately, I am not well enough versed in GDI+ to make any headway and using "print screen" and the clipboard seems like overkill.

Thanks for your efforts.

Regards,

Jim

Link to comment
Share on other sites

Yes, the images must be exactly superimposed.

I have 4 images, the first is a basemap (a jpeg) with topo, roads, rivers, etc from NOAA. The second (a transparent gif) is the current radar scan, the third (a transparent gif) are any current warning boxes, and the fourth (a transparent gif) is one I generate to show my current position relative to the combined radar image. The result looks similar to the image you supplied just built up from several exactly superimposed images.

Interestingly, I have combined these same images using a product called RideRunner which uses GDI+ but I don't have source.

I have also successfully combined them in AutoIt using seperate overlapping GUIs, one per image, but that results in the capture problem as well as some others when I integrate this process with others.

I have not successfully combined them using one picture control something I am working on right now as I believe that will solve the capture problem. BTW, if you have any thoughts on this I would appreciate hearing them.

If all else fails, I'll either drop the zooming idea or go with PrintScreen.

Regards,

Jim

Link to comment
Share on other sites

Thanks, the GDI example ran fine.

Now before I get myself in over my head, should this merge my jpeg, and 3 gifs into one overlayed image?

To see if I can beat you to it, I'm off to try. In the meantime, if the current example won't do that, what changes would I have to make to do so?

I can supply images if you need them.

Regards,

JIm

Link to comment
Share on other sites

Beat ya.

Brilliant, great, fantastic, it overlay-ed things just fine and gave me a single image.

Many, many thanks.

After almost 50 years of programming and programming management, I still get a rush when something finally works.

But I must admit that all of this is a bit esoteric for my old blood.

Again, many thanks.

Regards,

Jim

Link to comment
Share on other sites

One last question (he asks with hat in hand).

How do I write the resulting image to a file?

I tried adding:

Local $myImage = _GDIPlus_BitmapCreateFromGraphics(600, 550, $hGraphic)
    _GDIPlus_ImageSaveToFile ($myImage, "C:\Casita\Weather Maps\site_composite2.jpg")

after the line:

_WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)

in the WM_PAINT function but got an all black image in the output file.

What am I missing, it looked like this would work in a GDI+ example in the help file.

Regards,

Jim

Link to comment
Share on other sites

OK, got it all working including the original objective, building a zoomed image.

Thanks again for all the help and persistence.

BTW, can the processing that is done in your WM_PAINT function simply be done inline after the GUISetState()?

Regards,

Jim

Link to comment
Share on other sites

Good to know, I will leave it as it is.

BTW, when it rains it pours. In my search for an answer I ran across a UDF called FreeImage which will accomplish the same thing. However, it is a bit of overkill as it is intended to do lots of much more esoteric things with images so I will stay with your approach.

And again many thanks.

Regards,

Jim

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...