Imagine the situation. Our product
can determine under the control of
WineHQ whether it is launched or not. And in our very product there are many places from which we have to open a URL. Product information, check for updates, online help, tech support page and more. In the forehead, try ShellExecute, passing the URL parameter, and ... puzzled. Nothing happens!
The fact is that Wine, honestly emulating everything, will want to launch a browser installed not in the system, but installed under Wine. On the bare Wine this is not observed. Therefore, nothing happens.
Of course, you can install the browser, but why not open the necessary documents in the applications native to the system. This raises the question of the interaction between the emulator and the operating system.
There are a number of
commands for this in the Wine collection. I do not like the term “team”, but it is translated literally.
')
Among them is the
winebrowser command, which opens the URL in the native application from the operating system set. And given that the URL can refer to the file, we have a really serious mechanism in our hands.
winebrowser https: //www.winehq.org
winebrowser ftp.winehq.org
winebrowser irc: //irc.freenode.net/#winehq
winebrowser file: // c: \\ windows \\ win.ini
For example, in KDE, the first two URLs, in theory, should open in Konqueror, the third in Konversation, and the last in KWrite.
As a result, using the GetWineAvail () function described
earlier , our code might look like this:
// Delphi Codeprocedure OpenUrl (url
: string )
;varS
: string ;beginif GetWineAvail ()
thenS
: = 'winebrowser' + url
elseS
: = url
;ShellExecute (
0, 'open' , PChar (S)
, nil , nil , SW_SHOW )
;end ;...OpenURL (
'mailto: support@microolap.com? Subject = PgMDD:% 20Support Request' )
;OpenURL (
'https: //microolap.com/products/database/postgresql-designer/help/' )
;...or so:
// C Codevoid OpenUrl (
char * url);
{
char s [
255 ];
if (GetWineAvail ())
{
strcpy (s,
"winebrowser" );
strcat (s, url);
}
else{
strcpy (s, url);
}
ShellExecute (
NULL ,
"open" , s,
NULL ,
NULL , SW_SHOW);
}
...
OpenURL (
"mailto: support@microolap.com? Subject = PgMDD:% 20Support Request" );
OpenURL (
"https: //microolap.com/products/database/postgresql-designer/help/" );
...