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 


[Delphi] Opening a local .html file with my browser

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iamok
Expert Cheater
Reputation: 0

Joined: 04 Feb 2007
Posts: 247

PostPosted: Thu Jan 10, 2008 8:57 pm    Post subject: [Delphi] Opening a local .html file with my browser Reply with quote

Okay, so I'm working on something. And what I'd like to do is to open any .html with my default browser, using the menu of my delphi application.

So basically, If I went "File > Open" and selected a .html file, it'd open with my default browser, and not my delphi application.

Thanks.

_________________
TheOKLibrary - 306 tutorials, 80 downloads. And counting!
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Thu Jan 10, 2008 9:02 pm    Post subject: Reply with quote

i dont quite get what ur saying...

so u wanna open a .html file from your delphi aplication... like through a button?

or do u mean a file extention? so if u open a .html it opens ur delphi app?

explain beter

_________________
Back to top
View user's profile Send private message
iamok
Expert Cheater
Reputation: 0

Joined: 04 Feb 2007
Posts: 247

PostPosted: Thu Jan 10, 2008 9:10 pm    Post subject: Reply with quote

I mean say I have a bunch of help files, If I opened my application, but got stuck with something, I could go file > open select a .html file, and it would open in my browser so I could read it.
_________________
TheOKLibrary - 306 tutorials, 80 downloads. And counting!
Back to top
View user's profile Send private message
thephoneguy
Grandmaster Cheater
Reputation: 1

Joined: 17 Mar 2007
Posts: 873

PostPosted: Thu Jan 10, 2008 9:38 pm    Post subject: Reply with quote

couldnt you just do an on click event with shellexecute? or maybe i am misunderstanding you.
_________________
If you see me posting referring to an earlier conversation 9/10 times it was in the chatbox at baby Very Happy.
Back to top
View user's profile Send private message
iamok
Expert Cheater
Reputation: 0

Joined: 04 Feb 2007
Posts: 247

PostPosted: Thu Jan 10, 2008 9:40 pm    Post subject: Reply with quote

ThePhoneGuy wrote:
couldnt you just do an on click event with shellexecute? or maybe i am misunderstanding you.


Well if i did that, wouldn't I have to do it for each individual html file anyways. Which would defeat the purpose of using a menu.

_________________
TheOKLibrary - 306 tutorials, 80 downloads. And counting!
Back to top
View user's profile Send private message
thephoneguy
Grandmaster Cheater
Reputation: 1

Joined: 17 Mar 2007
Posts: 873

PostPosted: Thu Jan 10, 2008 9:45 pm    Post subject: Reply with quote

lol copy and paste or maybe shell execute with the site being a var and defined by what you type in the menu?
_________________
If you see me posting referring to an earlier conversation 9/10 times it was in the chatbox at baby Very Happy.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jan 11, 2008 3:43 am    Post subject: Reply with quote

ShellExecute will work for this. Use the "open" command with it and point it to the path of the HTML file.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
iamok
Expert Cheater
Reputation: 0

Joined: 04 Feb 2007
Posts: 247

PostPosted: Fri Jan 11, 2008 4:20 pm    Post subject: Reply with quote

Where exactly would I implement shellexecute?

This is what I'm using (from delphibasics)

Code:

 var
  openDialog : TOpenDialog;
begin
  openDialog := TOpenDialog.Create(self);
  openDialog.InitialDir := GetCurrentDir;
  openDialog.Options := [ofFileMustExist];
  openDialog.Filter :=
    'HTML File|*.html|';
  openDialog.FilterIndex := 1;
  if openDialog.Execute
  then ShowMessage('File : '+openDialog.FileName)
  else ShowMessage('Open file was cancelled');
  openDialog.Free;
end;

_________________
TheOKLibrary - 306 tutorials, 80 downloads. And counting!
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Fri Jan 11, 2008 7:05 pm    Post subject: Reply with quote

ShellExecute with openDialog.FileName as the url paramater?
I'm not sure, I haven't used Delphi before, but that's what I would do for VB

_________________
Back to top
View user's profile Send private message
iamok
Expert Cheater
Reputation: 0

Joined: 04 Feb 2007
Posts: 247

PostPosted: Fri Jan 11, 2008 9:42 pm    Post subject: Reply with quote

Thanks for your help, I got it in the end.

turns out it was

Code:

begin
openDialog1.Filter :=
'HTML File|*.html|';
openDialog1.FilterIndex := 1;
if openDialog1.Execute  then
Edit1.text :=(''+openDialog1.FileName);
begin
if Edit1.Text='' then
Application.Initialize
else
Shellexecute(handle,'',PChar(Edit1.Text),'','',SW_NORMAL);
Edit1.Text:='';
end;

_________________
TheOKLibrary - 306 tutorials, 80 downloads. And counting!
Back to top
View user's profile Send private message
iRiot
Master Cheater
Reputation: 0

Joined: 03 Jul 2007
Posts: 395
Location: Aka RIOT

PostPosted: Fri Jan 11, 2008 10:18 pm    Post subject: Reply with quote

iamok wrote:
Thanks for your help, I got it in the end.

turns out it was

Code:

begin
openDialog1.Filter :=
'HTML File|*.html|';
openDialog1.FilterIndex := 1;
if openDialog1.Execute  then
Edit1.text :=(''+openDialog1.FileName);
begin
if Edit1.Text='' then
Application.Initialize
else
Shellexecute(handle,'',PChar(Edit1.Text),'','',SW_NORMAL);
Edit1.Text:='';
end;


lol thanks to me

_________________
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