There is no exception to catch, because the exception does not occur when it LoadLibraryfails; it just returns "0".
You should check if "dllHandle" is 0 or not, if so, show the user error information using GetLastErroras documented. Alternatively, you can use the function Win32Checkin RTL, which will throw an exception with the corresponding error message:
( edit: "LoadLibrary" , : To enable or disable error messages displayed by the loader during DLL loads, use the SetErrorMode function. , , , LoadLibrary.)
var
dllHandle: HMODULE;
ErrorMode: UINT;
begin
if OpenDialog1.Execute then begin
ErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS); // disable OS error messages
try
dllHandle := LoadLibrary(PChar(OpenDialog1.FileName));
finally
SetErrorMode(ErrorMode);
end;
if Win32Check(Bool(dllHandle)) then begin // exception raised if false
// use the libary
end;
end;
end;