I have a program that calls a DLL stored in the same folder that the program is stored in. When I run the calling code, either from the IDE or the program directly, it finds the DLL and gives no errors. But, when the client runs the program, it gives the error "Unable To Load DllSendOrder2018.dll". This behavior just started. On old versions of the code, it loads with no errors (other than another problem I need to fix).
procedure TFrmMain.BtnSendOrderClick(Sender: TObject);
var
SendOrders : procedure; stdcall;
begin
DLLHandleSend := LoadLibrary('DllSendOrder2018.dll');
if DLLHandleSend <> 0 then
begin
@SendOrders := GetProcAddress(DLLHandleSend,'SendOrders');
try
SendOrders;
except
on E: Exception do
ShowMessage(E.Message);
end;
FreeLibrary(DLLHandleSend);
end
else
MessageDlg('Unable To Load DllSendOrder2018.dll',mtError,[mbOk],0);
FldLookup.SetFocus;
end;
Is there a better place to put the DLL?