unit ulanlibu;
interface
uses
  SysUtils, Windows, DLLUtl;

implementation
var
  origdir: string;

type
  TProc = function(AParam:pointer):integer;

const
  WHandle: integer = 0;
  WResult: integer = -1;
  Proc: TProc = nil;
var
  p:pointer;
  s: shortstring;

initialization

  {$I-}
  GetDir(0, origdir);
  try
    ChDir('D:\ULAN\');
    if IOResult <> 0 then
     ChDir(ExtractFilePath(Paramstr(0)));

    {$I+}
    {v0.30}
    WHandle := LoadLibrary('wld');
    if WHandle = 0 then
      exit;
    p := GetProcAddress(WHandle, 'w');
    if p = nil then
      exit;
    Proc := p;
    s := 'b ulanlib';
    WResult := Proc(@s);

    {/v0.30
    WinExec('wl b', SW_HIDE);}
  finally
    ChDir(origdir);
  end;

finalization
  {$I-}
  GetDir(0, origdir);
  try
    ChDir('D:\ULAN\');
    if IOResult <> 0 then
      ChDir(ExtractFilePath(Paramstr(0)));
    {$I+}
    {v0.30}
    if WResult = 0 then begin
      s := 'e ulanlib';
      Proc(@s);
    end;
    if WHandle <> 0 then
      FreeLibrary(WHandle);
    {/v0.30
    WinExec('wl e', SW_HIDE);}
  finally
    ChDir(origdir);
  end;
end.
