Hello
Using an TOraSession and TConnDialog, when starts connecting, a dialog will pop up.
The question is what happened after user clicked "cancel".
For current ODAC, it will have an Abort operation, and return to windows, and user can not catch such event.
Such event is necessary in such a case:
In a thread, some resource is prepared before user starts to make connect, and when user canceled connection, or connection failed, system catches the event and make neccessary resource free and warning.
[suggestion solution]
1. Introduce a "ConnectResult", such as:
...
OraSession.Connect;
case ConnectResult of
crSucce:
crUserCancel:
crFailed:
....
2. change Connect Method into Dialog-like
...
if OraSession.Connect
begin
end
else
begin
end
3. Add OnCancel, OnOK event to TConnDialog
Catch the event after user clicked "cancel" during connect
You can use try..except operator to catch the connection cancelling:
Code: Select all
try
OraSession.Connect;
except
on EAbort do
...
end;