Bde.DBTables.TSession.GetPassword

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function GetPassword: Boolean;

C++

bool __fastcall GetPassword();

プロパティ

種類 可視性 ソース ユニット
function public
Bde.DBTables.pas
Bde.DBTables.hpp
Bde.DBTables TSession

説明

セッションの OnPassword イベントハンドラを呼び出すか,デフォルトのパスワードダイアログボックスを表示します。

GetPassword メソッドは,アプリケーションがパスワード保護された Paradox ファイルを開くときのセッションおよびハンドラの応答ロジックに対して OnPassword イベントハンドラを呼び出します。OnPassword イベントハンドラを定義していないときは,GetPassword はデフォルトのパスワードダイアログボックスを表示します。

アプリケーションは GetPassword の戻り値を使ってプログラムロジックを制御できます。ユーザーが[OK]を選択すると GetPassword は true を返し,Cancel を選択すると false を返します。



var
rslt: Boolean;
begin
rslt := Session.GetPassword;
try
if rslt then
Table1.Open
else
ShowMessage('No password given');
except
ShowMessage('Could not open table!');
end;
ifnot Table1.Active then
Application.Terminate;
end;



void __fastcall TForm1::OpenTableButtonClick(TObject *Sender)
{
bool rslt = Session->GetPassword();
try
{
if (rslt)
Table1->Open();
else
ShowMessage("No password given");
}
catch (...)
{
ShowMessage("Could not open table!");
}
if (!Table1->Active)
Application.Terminate();
}



関連項目