Lazarus
Using the Lazarus IDE => Editor => Topic started by: Nisbo on March 08, 2005, 04:15:52 pm
-
first, sorry for my bad english, but i am from germany
How to make a simple Link ?
this is my questing, i searched in google and I found for delphi:
ShellExecute(handle,nil,'http://www.google.de',nil,SW_SHOW)
shellexecute(0, 'open', 'http://www.google.de', nil, nil, sw_show);
but it doesnt work in lazarus
maybe there is an other funktion to make a simple html-link like a link to a supportpage
-
OK no answer is also an answer :roll:
the solution is
insert inso uses: ShellAPI
and you can use
procedure TForm1.MenuItem3Click(Sender: TObject);
var sw_show: longint;
begin
Shellexecute(handle,'open',PChar('http://www.google.de'),'','',sw_show);
end;
-
OK next question
I try to open notepad (W2K)
Shellexecute(Application.Handle,'open',PChar('C:\WINNT\NOTEPAD.EXE'),nil,nil,sw_show);
but it doesnt work, whats wrong ?
-
Use ExecuteProcess instead
Try like this:
ExecuteProcess('C:\WINNT\NOTEPAD.EXE','');
second arguments are arguments passed to Notepad
-
ok my mistake was that i forgot to insert Windows in units
now it works
procedure TForm1.MenuItem5Click(Sender: TObject);
begin
Shellexecute(handle,'open',PChar('http://www.google.de'),'','',sw_show);
end;
-
Also don't use Application.Handle, that handle is invalid, bug ...
-
Is there a universal way on to how to make a click able link suitable for all platforms?
Using Windows specific units comes with complications for Linux etc?? (or not?)
-
Using Windows specific units comes with complications for Linux
Not necessarily.
Anyway, you can put IFDEF directive in your code.
{$IFDEF WINDOWS}
// Windows specific part
{$ENDIF}
-
IFDEF is a good approach,... if I would know;
a) which platform identifications I'd use in the IFDEF (win32, linux,... but not sure about Mac OSX and such?)
b) what to call for on the other platforms (which I do not - yet)
:)
-
I edited my post after you posted yours. See it again.
For a complete example, see eg. SynEdit source.
-
Thanks :)
-
Is there a universal way on to how to make a click able link suitable for all platforms?
Using Windows specific units comes with complications for Linux etc?? (or not?)
I use OpenURL and OpenDocument from the unit LCLIntf. The only problem I found on the Raspberry Pi, is when xdg-open is not setup with a valid default browser.
The following will show your current default browser
xdg-settings get default-web-browser
I believe I had to use something like this to make it work with firefox. (I guess it depends on the linux distro)
xdg-settings set default-web-browser firefox-esr.desktop
-
You're commenting to a thread that's 15 years old, and most if not all of the participants have moved on.
I use OpenURL and OpenDocument from the unit LCLIntf. The only problem I found on the Raspberry Pi, is when xdg-open is not setup with a valid default browser.
That is of course an interesting point, and you deserve a point for investigating xdg-open. However you've got a definite distro bug there, and you need to make sure it's reported as a bug to the RPi maintainers.
MarkMLl