Hello,

I'm very new to DOA and I'm trying to create a custom login screen for my client application and can't seem to get it to work properly. To make this explanation easier, I'm using the 3-tier demo provided in the DOA installation. Basically, all I did was add another form with 2 edit boxes and a button. Here's the code on the server and client.

SERVER FUNCTION
function TServerDMClass.Login(const Username: WideString; const Password:WideString): WordBool;
begin
Result := DefaultInterface.Login(Username, Password);
end;

CLIENT
procedure TForm1.Button1Click(Sender: TObject);
begin
if RemoteServer.AppServer.Login(edit1.text, edit2.text) then
begin
application.CreateForm(tmainform, mainform);
mainform.DeptClientDataSet.Active := True;
mainform.EmpClientDataSet.Active := True;
mainform.ShowModal;
end
else begin
raise Exception.Create('Invalid username/password');
end;
end;

If I set the LoginPrompt of the DComConnection to True, the default dialog box appears no matter what code exists on the OnLogin event. If I attach this code to a button, at runtime I get an error message of "...EOLEError with message 'Variant does not reference an automation object'". When I set the LoginPrompt of the TDCOMConnection to false and move the above code to the DCOM's OnLogin event, the component
is connected without any password at all. Is this a bug? What exactly am I doing wrong?



------------------
----------
Jay


----------
Jay