I’m looking for a way to open the default browser on a specified URL.
did someone already implemented it?
and a call to exec external programs?
michele
I’m looking for a way to open the default browser on a specified URL.
did someone already implemented it?
and a call to exec external programs?
michele
Boy, I think that would be hard to perform in a platform independent way.
(Granted, I don’t spend much time in platforms other than FreeBSD, Linux, and
BeOS
But if there were a way to do it (even if it was only workable on a few OSes),
I’d be interrested in knowing as well.On Sun, 18 Feb 2001, you wrote:
I’m looking for a way to open the default browser on a specified URL.
did someone already implemented it?
–
Sam “Criswell” Hart <@Sam_Hart>
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/
Plus, I’m sure this would be out of the scope of SDL ;)On Sun, 18 Feb 2001, you wrote:
I’m looking for a way to open the default browser on a specified URL.
did someone already implemented it?
–
Sam “Criswell” Hart <@Sam_Hart>
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/
Here there is a start, it does not block the main application (it seems
to me :P):
//------- start of main.c
#include <stdlib.h>
#ifdef WIN32
// c:\command\start.exe is a program used by windows
// to start the application registered for an URI so if you start
// it with http:// it opens the default web server
#define SDL_URL_LINE “start %s”
#else
// this works under linux (and I think with other *NIX)
#define SDL_URL_LINE “sh -c “netscape %s”&”
#endif
// BEOS, MAC, FreeBSD who wants to add the code for them ?
int SDL_Url(char * url){
char *str;
str=calloc(sizeof(char),1024);
sprintf(str,SDL_URL_LINE,url);
system(str);
}
int main(int argc, char *argv[]){
int i=0;
SDL_Url(argv[1]);
while(i<1000){
printf("%d…",i++);
}
puts("");
//-- end of main .c
Samuel Hart wrote:>
Boy, I think that would be hard to perform in a platform independent way.
(Granted, I don’t spend much time in platforms other than FreeBSD, Linux, and
BeOSBut if there were a way to do it (even if it was only workable on a few OSes),
I’d be interrested in knowing as well.–
Sam “Criswell” Hart
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/
I’m terribly sorry to report this, but “start.exe” doesn’t exist for Windows
NT. (well, at least for NT4, I can’t verify with NT5)
Olivier A. Dagenais - Software Architect and Developer
“michele” <paint.i at tiscalinet.it> wrote in message
news:3A901FB7.E567D799 at tiscalinet.it…
Here there is a start, it does not block the main application (it seems
to me :P)://------- start of main.c
#include <stdlib.h>#ifdef WIN32
// c:\command\start.exe is a program used by windows
// to start the application registered for an URI so if you start
// it with http:// it opens the default web server
#define SDL_URL_LINE “start %s”
#else
// this works under linux (and I think with other *NIX)
#define SDL_URL_LINE “sh -c “netscape %s”&”
#endif
// BEOS, MAC, FreeBSD who wants to add the code for them ?int SDL_Url(char * url){
char *str;
str=calloc(sizeof(char),1024);
sprintf(str,SDL_URL_LINE,url);
system(str);
}int main(int argc, char *argv[]){
int i=0;
SDL_Url(argv[1]);
while(i<1000){
printf("%d…",i++);
}
puts("");//-- end of main .c
Samuel Hart wrote:
Boy, I think that would be hard to perform in a platform independent
way.(Granted, I don’t spend much time in platforms other than FreeBSD,
Linux, andBeOS
But if there were a way to do it (even if it was only workable on a few
OSes),I’d be interrested in knowing as well.
–
Sam “Criswell” Hart
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/
Here there is a start, it does not block the main application (it seems
to me :P):
I don’t think that URLs and browsers are either simple, direct or media
layers
Perhaps this would be something for the code snippets section on
sourceforge.
0.02$
Olivier Dagenais wrote:
I guess we’ll have to use ShellExecute for Win32… However, I don’t think
it is within the scope of SDL…
why? from the SDL manual :
"SDL is a free cross-platform multi-media development API"
as I’m trying to handle a multi-media content (a web page) with a
cross-platform solution this should be within the scope of SDL.
michele
PS: I don’t want to start a flame but I’d want to improve SDL
I don’t know if I think that this should be placed directly into the SDL,
but perhaps it would make a good library to add on.
Actually, from the sounds of it, it could be made into a simple public
domain .h file, with a single macro.
In fact, it might be nice to have it do several protocols (mailto:, ftp:,
etc).
PS: the version of NT4 I have sitting in front of me has a program called
start that does exactly what she said (ran it from the command prompt
myself).
#include <InternetConfig.h>
int LaunchURLMac(char *url)
{
OSStatus error = noErr;
long s=0, e=0;
ICInstance inst;
Str255 name;
FSSpec spec;
ProcessInfoRec pinfo;
ProcessSerialNumber psn = { 0, kCurrentProcess };
pinfo.processInfoLength = sizeof(pinfo);
pinfo.processAppSpec = &spec;
pinfo.processName = name;
error = GetProcessInformation(&psn, &pinfo);
if (error != noErr)
{
pinfo.processSignature = '????';
error = noErr; /* not a hard error */
}
error = ICStart(&inst, pinfo.processSignature);
if (error == noErr)
{
#if !defined(TARGET_API_MAC_CARBON) || !TARGET_API_MAC_CARBON
error = ICFindConfigFile(inst, 0, nil);
#endif /* !TARGET_API_MAC_CARBON */
if (!error) error = ICLaunchURL(inst, 0, url strlen(url), &s, &e);
ICStop(inst);
}
return((error) ? 0 : 1); /* return true if success */
}–
/* Matt Slot * Bitwise Operator * http://www.ambrosiasw.com/~fprefect/ *
Can’t see what’s so non-portable about something like
SDL_OpenBrowser("http://www.linuxaudiodev.com/maia");
Can be implemented one way or another on all platforms I know of that
have web browsers… Short of using a standard system API, one can
always resort to making it a user configuration option which program
to use when opening a HTTP or FTP link. Browsers seem to have very
similar command line syntax, and many automatically forward the
request to a running instance if possible. (Nutscrape/Linux doesn’t
seem to, but that might have changed lately… I use Konqueror most
of the time these days.)
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Sunday 18 February 2001 16:38, Samuel Hart wrote:
On Sun, 18 Feb 2001, you wrote:
I’m looking for a way to open the default browser on a specified
URL. did someone already implemented it?Boy, I think that would be hard to perform in a platform
independent way. (Granted, I don’t spend much time in platforms
other than FreeBSD, Linux, and BeOSBut if there were a way to do it (even if it was only workable on a
few OSes), I’d be interrested in knowing as well.
Joe Tennies wrote:
start that does exactly what she said (ran it from the command prompt
SHE?!
do you know that the difference beetween michele and michelle is not
only in pronunciation?!
i’m a big fat GUY!
michele (please remember: i’m a HE)
unless you’re running a system where the proper command is “kfmclient
openURL “%s””.On Sunday 18 February 2001 11:17 am, michele wrote:
#else
// this works under linux (and I think with other *NIX)
#define SDL_URL_LINE “sh -c “netscape %s”&”
–
Neil Stevens
multivac at fcmail.com
@Neil_Stevens
keyserver search.keyserver.net
Fingerprint 86EA ECD4 F258 FB1B D88F 9136 4F49 90F8 CD3E 5C1C
PS: the version of NT4 I have sitting in front of me has a program called
start that does exactly what he said (ran it from the command prompt
myself).
Olivier A. Dagenais - Software Architect and Developer
Sorry. No offense. I’m just dum.> ----- Original Message -----
From: owner-sdl@lokigames.com [mailto:owner-sdl at lokigames.com]On Behalf
Of michele
Sent: Monday, February 19, 2001 2:12 AM
To: sdl at lokigames.com
Subject: Re: [SDL] Re: wish list for SDLJoe Tennies wrote:
start that does exactly what she said (ran it from the command prompt
SHE?!
do you know that the difference beetween michele and michelle is not
only in pronunciation?!
i’m a big fat GUY!michele (please remember: i’m a HE)
PS: the version of NT4 I have sitting in front of me has a program
calledstart that does exactly what he said (ran it from the command prompt
myself).Confirmed: there is no program called ‘start.exe’, however the NT command
prompt interpreter recognizes “start filename” and will launch the
appropriate program or association. Since Win95 doesn’t have a special
command interpreter, they implemented this functionality with an external
program. Technically, we were both right…
Problem is, you can’t execute a command from the command interpreter like an
.exe file…
That’s funny if you use start.exe in an autorun.inf file on a cd (doesn’t
run in WinNT)
M$ sucks badly.
Problem is, you can’t execute a command from the command interpreter like
an
.exe file…
That’s funny if you use start.exe in an autorun.inf file on a cd (doesn’t
run in WinNT)
Again, that’s because “start” isn’t an EXE on NT. If I remember correctly,
there are Autorun.inf extensions that allow you to specify what parameters
you want to call ShellExecute with, so there is another way to do it. (I
think you could also use a batch file…)
Olivier A. Dagenais - Software Architect and Developer
Can’t see what’s so non-portable about something like
SDL_OpenBrowser("http://www.linuxaudiodev.com/maia");
Do you really thing this is a task for SDL?
I think that it isn’t.
Just create a few #define
#define linux
if(fork())
{
exec …
}
#endif
#define WIN32
…
Can’t see what’s so non-portable about something like
SDL_OpenBrowser("http://www.linuxaudiodev.com/maia");
Do you really thing this is a task for SDL?
I think that it isn’t.
I agree it shouldn’t be in the core SDL API, but as an extension I would be
interested (perhaps something like SDL_Other or SDL_Misc or even as a group of
functions in something called SDL_Desktop? Perhaps giving the ability to launch
other things like editors, mailers and such)
Just create a few #define
The problem with this (as has been shown) is that some browser pop-ups in some
OSes aren’t quite that simple.
Plus, for some people (like myself) who only develop under one platform, coming
up with complicated, all inclusive, #defines (and testing them) would be more
trouble than they’re worth. I agree a simple, common function would be nice…
just not in core SDL :-)On Tue, 20 Feb 2001, you wrote:
–
Sam “Criswell” Hart <@Sam_Hart>
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/
Can’t see what’s so non-portable about something like
SDL_OpenBrowser("http://www.linuxaudiodev.com/maia");
Do you really thing this is a task for SDL?
I think that it isn’t.
IMHO, opening various sorts of files with the user’s favourite viewer or
editor is one of the tasks that should have a clean and simple API in every
serious desktop OS. It would be rather natural for any library that deals
with files and other basic stuff to include a portable wrapper for it.
Now, this is utopia (so far), so the wrapper would have to be slightly more
than a wrapper, an possibly not even doing exactly what’s intended on all
platforms, but I still think it’s better than hacking it directly into every
application that needs it.
It might be a good idea to keep it in a separate library rather than
including it in the main SDL package, but OTOH I’m worried about how to
"market" a library that can do only one thing, towards developers. It has to
be used to be of any help…! It doesn’t help me that there is a lib if
application X that I’m trying to build doesn’t use it.
Just create a few #define
#define linux
if(fork())
{
exec …
}
#endif
#define WIN32
…
How am I supposed to know how to do this on Mac OS or BeOS, or any other OS
that I hardly ever use…? And no, no one would send me a patch, as the code
would (unless I did something really stupid) just build wit this feature
disabled on any platform I did’t know about, so users would never notice that
the code is slightly broken.
Platform dependent stuff should be managed separately, and never in the
middle of application code; preferably not in the application code at all.
I’d rather see SDL “bloated” with a few kB than having to fix "SDL"
applications that won’t build on GNU/Linux, just because the author
absolutely required a web link to work, but doesn’t know that others than
Microsoft make operating systems…
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Tuesday 20 February 2001 18:23, x5101920 at fedro.ugr.es wrote:
See I completely agree…
How 'bout this, are their other related (no flaming for the overly general
term functions that, while they don’t really /fit/ into the core SDL, they
sure would be nice to have?
I’m thinking some other app pop-ups would be nice… but many would get
increasingly hard on certain platforms (my platforms of choice being the
biggest culprits here
For example, in this same vein, I would really like to be able to pop-up the
native OS/WM’s display settings dialog (if it exists). This way, once could let
the user do things like resize the screen, turn-off screensavers, etc. I know
this doesn’t really work very well across platforms (only a few WM’s even have
something like this on *nix variants)… but it would be a nice feature to
include in a lib which had a pop-up browser function…
(sorry, just rambling now… I’ll shut-up :-)On Tue, 20 Feb 2001, you wrote:
It might be a good idea to keep it in a separate library rather than
including it in the main SDL package, but OTOH I’m worried about how to
"market" a library that can do only one thing, towards developers. It has to
be used to be of any help…! It doesn’t help me that there is a lib if
application X that I’m trying to build doesn’t use it.
–
Sam “Criswell” Hart <@Sam_Hart>
AIM, Yahoo!, MSN:
Homepage: http://www.geekcomix.com/snh/
PGP Info: http://www.geekcomix.com/snh/contact/