 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 3:50 pm Post subject: How do I open a web browser in Delphi 7? |
|
|
| I tried using the Shell thing and selected the Start Menu but that didn't work :/ I need a code that will open a certain web page. Like for a random button :/ Thanks mucho.
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 3:55 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| [SM] Oblivion's Grave wrote: | | I tried using the Shell thing and selected the Start Menu but that didn't work :/ I need a code that will open a certain web page. Like for a random button :/ Thanks mucho. |
http://delphi.about.com/od/windowsshellapi/a/executeprogram.htm
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 4:06 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 4:16 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| [SM] Oblivion's Grave wrote: |
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
Show entire code.
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 4:20 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| dnsi0 wrote: | | [SM] Oblivion's Grave wrote: |
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
Show entire code. |
That is the entire code o.O
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 4:44 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| [SM] Oblivion's Grave wrote: | | dnsi0 wrote: | | [SM] Oblivion's Grave wrote: |
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
Show entire code. |
That is the entire code o.O |
Oh then lol. Do you know how a unit is composed of? I suggest you read more delphi tutorials or books before trying this.
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 5:25 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| dnsi0 wrote: | | [SM] Oblivion's Grave wrote: | | dnsi0 wrote: | | [SM] Oblivion's Grave wrote: |
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
Show entire code. |
That is the entire code o.O |
Oh then lol. Do you know how a unit is composed of? I suggest you read more delphi tutorials or books before trying this. |
D00d I'm not a dumbass, I know how to code in Pascal -.-" I just need a code to open your default web browser to a specific domain address. And no I am not showing my source. The error lies within what I have shown, am asking how to fix that.
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 6:03 pm Post subject: Re: How do I open a web browser in Delphi 7? |
|
|
| [SM] Oblivion's Grave wrote: | | dnsi0 wrote: | | [SM] Oblivion's Grave wrote: | | dnsi0 wrote: | | [SM] Oblivion's Grave wrote: |
Thanks, I tried this | Code: | function BrowseURL(const URL: string) : boolean;
var
Browser: string;
begin
Result := True;
Browser := '';
with TRegistry.Create do
try
RootKey := HKEY_CLASSES_ROOT;
Access := KEY_QUERY_VALUE;
if OpenKey('\htmlfile\shell\open\command', False) then
Browser := ReadString('') ;
CloseKey;
finally
Free;
end;
if Browser = '' then
begin
Result := False;
Exit;
end;
Browser := Copy(Browser, Pos('"', Browser) + 1, Length(Browser)) ;
Browser := Copy(Browser, 1, Pos('"', Browser) - 1) ;
ShellExecute(0, 'open', PChar(Browser), PChar(URL), nil, SW_SHOW) ;
end;
//usage
BrowseURL('http://forum.cheatengine.org/viewforum.php?f=64') ;
| But when I use it I get these errors and IDK how to fix them :/
| Code: | [Error] Unit1.pas(870): Declaration expected but identifier 'BrowseURL' found
[Fatal Error] Project1.dpr(4): Could not compile used unit 'Unit1.pas'
|
|
Show entire code. |
That is the entire code o.O |
Oh then lol. Do you know how a unit is composed of? I suggest you read more delphi tutorials or books before trying this. |
D00d I'm not a dumbass, I know how to code in Pascal -.-" I just need a code to open your default web browser to a specific domain address. And no I am not showing my source. The error lies within what I have shown, am asking how to fix that. |
THis is not enough. All the code seems to be right. Just show the entire pas file and delete the parts you don't want others to see.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25929 Location: The netherlands
|
Posted: Sat May 23, 2009 6:08 pm Post subject: |
|
|
I am assuming you've already added shellapi to the uses list
"Declaration expected but identifier 'BrowseURL' found "
Looks like you're calling BrowseURL without it being inside a begin/end block(, or at the initialization / finalization part)
Also, no need to fetch the browser from the registry, you can just open the url itself as long as it starts with http:// , it'll open the default webbrowser
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 6:34 pm Post subject: |
|
|
| Dark Byte wrote: | I am assuming you've already added shellapi to the uses list
"Declaration expected but identifier 'BrowseURL' found "
Looks like you're calling BrowseURL without it being inside a begin/end block(, or at the initialization / finalization part)
Also, no need to fetch the browser from the registry, you can just open the url itself as long as it starts with http:// , it'll open the default webbrowser |
How would I do that without having a FlashObject or TWebBrowser? Would I create a function like this : | Code: | function BrowseURL(const URL: string):String;
begin
BrowseURL('www.google.com');
end; | ?
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 7:11 pm Post subject: |
|
|
| [SM] Oblivion's Grave wrote: | | Dark Byte wrote: | I am assuming you've already added shellapi to the uses list
"Declaration expected but identifier 'BrowseURL' found "
Looks like you're calling BrowseURL without it being inside a begin/end block(, or at the initialization / finalization part)
Also, no need to fetch the browser from the registry, you can just open the url itself as long as it starts with http:// , it'll open the default webbrowser |
How would I do that without having a FlashObject or TWebBrowser? Would I create a function like this : | Code: | function BrowseURL(const URL: string):String;
begin
BrowseURL('www.google.com');
end; | ? |
check to make sure that all your begins have an end with it.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25929 Location: The netherlands
|
Posted: Sat May 23, 2009 7:15 pm Post subject: |
|
|
ShellExecute(0, 'open', 'http://www.google.com', nil, nil, SW_SHOW) ;
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 7:29 pm Post subject: |
|
|
| Dark Byte wrote: | | ShellExecute(0, 'open', 'http://www.google.com', nil, nil, SW_SHOW) ; |
God your smart o.O Thanks May I ask if you code in every language? Your like Bill Gates
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sat May 23, 2009 7:51 pm Post subject: |
|
|
| [SM] Oblivion's Grave wrote: | | Dark Byte wrote: | | ShellExecute(0, 'open', 'http://www.google.com', nil, nil, SW_SHOW) ; |
God your smart o.O Thanks May I ask if you code in every language? Your like Bill Gates  |
Lol its kinda funny you didn't scroll down in the web page I gave you because what darkbyte said was in that document XD.
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat May 23, 2009 11:21 pm Post subject: |
|
|
| dnsi0 wrote: | | [SM] Oblivion's Grave wrote: | | Dark Byte wrote: | | ShellExecute(0, 'open', 'http://www.google.com', nil, nil, SW_SHOW) ; |
God your smart o.O Thanks May I ask if you code in every language? Your like Bill Gates  |
Lol its kinda funny you didn't scroll down in the web page I gave you because what darkbyte said was in that document XD. |
And you wonder why your rep stays at -1 -.-" Don't post bullshit....its not needed.
@DB: Thanks for your help and I got it working, thank you.
|
|
| Back to top |
|
 |
|
|
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
|
|