Delphiのcpx側でやるとすると、こうかな・・・
1.usesに以下のユニットを追加。
SyncObjs
2.ユニット変数を宣言
var
CritSec:TCriticalSection;
3.ユニット関数(?)を宣言
procedure LibraryProc(Reason: Integer);
begin
case Reason of
DLL_PROCESS_ATTACH: begin
CritSec:=nil;
CritSec:=TCriticalSection.Create;
end;
DLL_PROCESS_DETACH: begin
if CritSec <> nil then
CritSec.Free;
CritSec:=nil;
end;
end;
end;
4.初期化処理(ユニットの手続き)を追加
DllProc := @LibraryProc;
LibraryProc(DLL_PROCESS_ATTACH);
5.フォルダ開始時にロックを確保を追加
Result := True;
if CritSec = nil then begin
pICmnPilot.cmnStatus ('フォルダロックエラー',TRUE);
Result := False;
end else begin
pICmnPilot.cmnStatus ('フォルダロック獲得待ち・・・',FALSE);
CritSec.Enter;
end;
6.フォルダ終了時にロックを開放を追加
CritSec.Leave;
うーむ、Delphiはどーにもよく判らない・・・
-- CMN v0.50β --