Get download file format and name in VC++

Get download file format and name in VC++

I am using Visual C++ to implement a function that could download image
from a query.
(for example
http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap
&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318
&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
)
Note that there's no image information associate with the query itself.
Now I can successfully download it, but I want to know if there is a way I
can find the download image format (i.e. jpg or png, etc) and the image
name?
Edit: if you try to save the image download from the above link, you can
see the browser could automatically save it as staticmap and with
extension png. I was wondering where the browser could get this
information?