View Single Post
  #1 (permalink)  
Old March 23rd, 2008, 01:23 PM
YoungLuke YoungLuke is offline
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default cross thread exception with windows live API

Hello,

I'm trying to create a utility that captures an image of a webpage based on the HTML from the source. I did some diging around and found that Windows Live makes an API with that functionality built in :) But when i try and use it i get the following error.

Code:
Uri uri = new Uri("http://www.msn.com");
WindowsLive.Writer.Api.HtmlScreenCapture hsc = new HtmlScreenCapture(uri, 800);

pictureBox1.Image = hsc.CaptureHtml(1000);

Error:
System.InvalidOperationException: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.

The line 'pictureBox`' refers to a control i have on my windows form.

When i call the basic
hsc.CaptureHtml(1000);

it returns the same error...

any ideas are welcome... Thanks in advance