Also, I am sure this used to work with Delphi 5, where the loadlibrary
would fail, I haven't got d5 installed anymore so I can't try it, but
any help would be appreciated.

I'm pretty sure its not the D6 variants thing as I have this patch.

Also there is a small error in the code below


function GetShellSettings(var MySFS: ShellFlagState; dwMask: Cardinal):
Boolean; stdcall;

begin
  Result := False;
  try
        SHGetSettings(MySFS, dwMask);
        Result := true;
  except
  end;
end;

-----Original Message-----
From: Jason Coley 
Sent: Wednesday, 16 July 2003 11:22 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Unit that references a dll that does not exist on a
system

To give more info, it's the ShGetSettings call that fails, in win95 and
sometimes in win98. I tried placing this call in a external dll and if
that dll does not load then it shouldn't continue with a certain block
of code.

But the dll always seems to load but when I call the function that is
external it fails and sends an error that cannot be trapped.

This is the function in my app

function GetMyShellSettings(var MySFS: ShellFlagState; dwMask:
Cardinal): Boolean;
var
  Handle: THandle;
  GetShellSettings: TGetShellSettings;
begin
  Result := False;
  Handle := LoadLibrary('alshwrap.DLL');
  if GetLastError <> null then
    if Handle <> null then
    begin
      @GetShellSettings := GetProcAddress(Handle, 'GetShellSettings');
      if GetLastError <> null then
        if Assigned(GetShellSettings) then
        begin
          Result := GetShellSettings(MySFS, dwMask);
        end;
      FreeLibrary(Handle);
    end;
end;

this is the dll

library alshwrap;

uses
  shlobj;

{$R *.res}

function GetShellSettings(var MySFS: ShellFlagState; dwMask: Cardinal):
Boolean; stdcall;

begin
  Result := False;
  try
        Result := SHGetSettings(MySFS, dwMask);
  except
  end;
end;

exports
        GetShellSettings;

begin
end.

-----Original Message-----
From: Jason Coley 
Sent: Wednesday, 16 July 2003 11:08 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Unit that references a dll that does not exist on a
system

If I have a exe that uses ShlObj and I try to load it on a win95 system
that
does not have the Desktop update installed, then the exe won't load.

 

Is there any ideas on how I can get around this?

 

Jason


------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to