Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C#]"URI Formats are not supported"

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed May 14, 2008 8:09 am    Post subject: [C#]"URI Formats are not supported" Reply with quote

Hi,

I'm trying to load a picture from the internet to a picture box, but I get "URI Formats are not supported" exception.

I tried using System.Net to see if I can download the picture or something, but I really don't know how to do it...

I did:
Code:
this.BackgroundImage = Image.FromFile("http://....com/....png");
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed May 14, 2008 4:54 pm    Post subject: Reply with quote

You can't pass a URL and expect it to download

you HAVE to call the downloading function and passing that to it.

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Wed May 14, 2008 6:09 pm    Post subject: Reply with quote

blankrider wrote:
You can't pass a URL and expect it to download

you HAVE to call the downloading function and passing that to it.


As in getting a parameter using another function.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed May 14, 2008 7:13 pm    Post subject: Reply with quote

I think it's just a simple DownloadFile call o.o

URLDownloadToFile

This will download the file to a file on the harddrive then you can call that file.

C Example

Code:
#include <urlmon.h>
#include <stdio.h>
IBindStatusCallback *stat;
char* file = "http://img174.imageshack.us/img174/9614/lawlep9.jpg";
int main(){
      if(URLDownloadToFile(0,file,"pic.jpg",0,stat))
   {
      MessageBox(0,"Error:\nFile Not Found or you are offline","Error",MB_OK | MB_ICONERROR);
      return 1;
   }
      
return 0;
}


Then of course you could always delete the image RIGHT after you use it and the user wouldn't know

_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed May 14, 2008 8:12 pm    Post subject: Reply with quote

Here's some C# that might help you:

Code:

//using System.Net;
WebClient Client = new WebClient ();
Client.DownloadFile("website", "path");
picMyPicture.Picture = "path"; //I have no idea how to work with these, so you're on your own here; just sorta threw you a bone. =P

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu May 15, 2008 11:49 am    Post subject: Reply with quote

blankrider wrote:
I think it's just a simple DownloadFile call o.o

URLDownloadToFile

This will download the file to a file on the harddrive then you can call that file.

C Example

Code:
#include <urlmon.h>
#include <stdio.h>
IBindStatusCallback *stat;
char* file = "http://img174.imageshack.us/img174/9614/lawlep9.jpg";
int main(){
      if(URLDownloadToFile(0,file,"pic.jpg",0,stat))
   {
      MessageBox(0,"Error:\nFile Not Found or you are offline","Error",MB_OK | MB_ICONERROR);
      return 1;
   }
      
return 0;
}


Then of course you could always delete the image RIGHT after you use it and the user wouldn't know


samuri25404 wrote:
Here's some C# that might help you:

Code:

//using System.Net;
WebClient Client = new WebClient ();
Client.DownloadFile("website", "path");
picMyPicture.Picture = "path"; //I have no idea how to work with these, so you're on your own here; just sorta threw you a bone. =P


Thanks you two. Smile

Edit: not sure how to convert URLDownloadToFile to C# and where does WebClient download the files to? O_O
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites