this is going in the languages section, as I'm using c# (so a solution in that would be ideal) but I think any relevant programming is more low-level so c/c++ stuff would be useful as well.
Right, I need a way to take a url and return an image - as in a Bitmap.
This is driving me crazy - is there actually any way?
I've looked into creating an instance of Internet Explorer (SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();)
and capturing the screen...
int hWindowDC, hOffscreenDC, hBMP, hBMPOld, r;
const int SRCCOPY = 13369376;
hWindowDC = GetWindowDC(hWnd);
hOffscreenDC = CreateCompatibleDC(hWindowDC);
hBMP = CreateCompatibleBitmap(hWindowDC, 800, 600);
hBMPOld = SelectObject(hOffscreenDC, hBMP);
r = BitBlt(hOffscreenDC, 0, 0, 800, 600, hWindowDC, 0, 0, SRCCOPY);
hBMP = SelectObject(hOffscreenDC, hBMPOld);
r = DeleteDC(hWindowDC);
r = DeleteDC(hOffscreenDC);
Bitmap ret = Image.FromHbitmap(new IntPtr(hBMP));
but this really isn't the ideal approach - for one I don't want the explorer window on top, which is of course vital if I'm capturing the screen. Is there any way I can do it 'behind the scenes'? Is there any way to do it without opening internet explorer for that matter?
Thanks for your time.