Opening URL under Wine

note This article available in Russian.

Imagine the following situation. Our product can detect if it is running under WineHQ already. And, indeed, our product has many places from which we must open URL’s:

  • information about the product,
  • checking for updates,
  • online help,
  • technical support page
  • and so on.

Trying to call ShellExecute head-on, passing the URL as parameter, and … Nothing happens!

The thing is that Wine, honestly emulating everything, wants to start a web browser not installed in the system, but installed under the Wine. There are no any browsers installed yet. Therefore, nothing happens.

Of course, you can install the browser, but why not open the required documents in their native system applications? This raises the question of interaction of the Wine and the operating system.

There are a number of commands available in Wine.

We are interested in winebrowser command, which opens the URL in the native operating system application. And taking into account that URL can refer to the file, we have really serious mechanism in our hands.

winebrowser httр://www.winehq.org

winebrowser ftp://ftp.winehq.org

winebrowser irc://irc.freenode.net/#winehq

winebrowser file://c:\\windows\\win.ini

On a KDE system the first two might open in Konqueror, the third in Konversation, and the last in KWrite.

As a result, applying the function GetWineAvail (), described earlier, our code might look like this:

//Delphi Code

procedure OpenUrl(url: string);
var
  S: string;
begin
  if GetWineAvail() then 
    S := 'winebrowser ' + url
  else
    S := url;
  ShellExecute(0, 'open', PChar(S), nil, nil, SW_SHOW);
end;

...
  OpenURL('mailto:support@microolap.com?Subject=PgMDD:%20Support');
  OpenURL('httр://microolap.com/products/database/postgresql-designer/');
...

or like this:

//C Code
void OpenUrl(char * url);
{
    char s[255];
    if (GetWineAvail())
    {
        strcpy(s, "winebrowser ");
        strcat(s, url);
    }
    else
    {
        strcpy(s, url);
    }
    
    ShellExecute(NULL"open", s, NULLNULL, SW_SHOW);
}

...
  OpenURL("mailto:support@microolap.com?Subject=PgMDD:%20Support");
  OpenURL("httр://microolap.com/products/database/postgresql-designer/");
...

PgMDD 1.2.10-beta available

This is a beta for the upcoming 1.2.10 release.

WineHQ compatibility improved. SQL Reverse Engineering improved. Support for 8.4.x SQL dialect added.

You’re welcome to download the latest release from our website at:
http://microolap.com/products/database/postgresql-designer/download/

Please don’t hesitate to ask any questions or report bugs with our Support Ticketing system.

PgMDD-1.2.8: Wine out of the box

Preface

As was mentioned PgMDD entered beta-testing stage. Details have been promised. Voilà.

Crux of the matter

PgMDD-1.2.8 supports WineHQ out of the box. What mean supports?

  • PgMDD always knows if it was launched under Wine or in pure Windows environment
  • PgMDD offers several ways to bypass imperfect Wine functionality
  • PgMDD disables the functionality which current Wine configuration cannot provide

Lets go on each item.

Continue reading “PgMDD-1.2.8: Wine out of the box”

On Wine or not on Wine?

note This article available in Russian.

In the life of every Windows developer there comes a point when you want to know if your application is running under WineHQ or not. Why? Because the world is not perfect. And you for sure will help Wine to crunch your application correctly. Of course if you’re interested in support of millions of guys with red eyes (Mac, Linux etc.). 😉

There is an elegant way to find this out. Below is the Pascal\Delphi code, however any sane developer would be able to translate it into preferred language:

function GetWineAvail: boolean;
var H: cardinal;
begin
 Result := False;
 H := LoadLibrary('ntdll.dll');
 if H > HINSTANCE_ERROR then
 begin
   Result := Assigned(GetProcAddress(H, 'wine_get_version'));
   FreeLibrary(H);
 end;
end;

//using
if GetWineAvail() then 
 ShowMessage('Launched under Wine')
else
 ShowMessage('Pure Windows');
end;

Сode speaks for itself.

Very freaking detailed tutorial from kishkin

Howdy, postgresmen!

There was some guy, Sherlok, who couldn’t start DB Designer in Wine properly. And I have no idea what he did wrong as my HOWTO is very simple. Yet it’s short… but not anymore! 😉 kishkin rewrote that tutorial with the screenshots, and there are LOTS OF THEM!

Here is photo, kishkin receving free license for Database Designer for PostgreSQL. Lot’s of friends came for the party. 🙂

free-license-party1