unit sub_api; //{$DEFINE _DEBUG} interface uses // my_settingfile, Windows, Messages, SysUtils, Variants, Graphics, Controls, Forms, Dialogs, ExtCtrls, Grids, ComCtrls, StdCtrls, Classes, _myIniFile, my_apitest; type TApp_TOOL_APITest = class(TForm) Panel_Top: TPanel; ComboBox_API: TComboBox; ComboBox_APIParam: TComboBox; Label_APITest_Declaration: TLabel; Shape_Border: TShape; Memo_Description: TMemo; Splitter1: TSplitter; Memo_Hint: TMemo; procedure FormCreate (Sender: TObject); procedure FormClose (Sender: TObject; var Action: TCloseAction); procedure FormDestroy(Sender: TObject); procedure ComboBox_APISelect (Sender: TObject); procedure ComboBox_APIParamSelect(Sender: TObject); private { Private 宣言 } FAPITest: T_MyAPITest; //設定ファイル // procedure FSetConfig; function FLoadIni: Boolean; procedure FSaveIni; public { Public 宣言 } function DoAPIInfo(hWindow: HWND; ptPos: TPoint): String; end; var App_TOOL_APITest: TApp_TOOL_APITest; procedure G_CreateAPITestForm; function G_TestExecute(hHandle: HWND; ptPos: TPoint): String; implementation uses {$IFDEF _DEBUG} _myDebug, {$ENDIF} CommCtrl, main, general; {$R *.dfm} procedure G_CreateAPITestForm; begin if not(gfnbFormExists(App_TOOL_APITest)) then begin App_TOOL_APITest := TApp_TOOL_APITest.Create(Application); end; end; function G_TestExecute(hHandle: HWND; ptPos: TPoint): String; begin G_CreateAPITestForm; Result := App_TOOL_APITest.DoAPIInfo(hHandle, ptPos); end; procedure TApp_TOOL_APITest.FormCreate(Sender: TObject); begin Memo_Description.Align := alClient; FAPITest := T_MyAPITest.Create; ComboBox_API.Items.Assign(FAPITest.Items); ComboBox_API.ItemIndex := 0; if not(FLoadIni) then begin ComboBox_APISelect(nil); end; end; procedure TApp_TOOL_APITest.FormClose(Sender: TObject; var Action: TCloseAction); begin G_APITestCallWindow.Action_Opt_DispAPITest.Checked := False; end; procedure TApp_TOOL_APITest.FormDestroy(Sender: TObject); begin FSaveIni; FAPITest.Free; end; procedure TApp_TOOL_APITest.ComboBox_APISelect(Sender: TObject); begin FAPITest.Name := ComboBox_API.Text; ComboBox_API.Hint := FAPITest.Declaration; Label_APITest_Declaration.Caption := FAPITest.Declaration; Memo_Description.Text := FAPITest.Description; ComboBox_APIParam.Items.Assign(FAPITest.Params); ComboBox_APIParam.ItemIndex := 0; ComboBox_APIParamSelect(nil); //↑でやっている // App_TOOLWinfo.SetAPICaption; end; procedure TApp_TOOL_APITest.ComboBox_APIParamSelect(Sender: TObject); begin FAPITest.Index := ComboBox_APIParam.ItemIndex; ComboBox_APIParam.Hint := FAPITest.ParamHint; Memo_Hint.Text := FAPITest.ParamHint; App_TOOLWinfo.SetAPICaption; end; //設定ファイル ----------------------------------------------------------------- const lcsSECT_BOUNDS = 'Bounds'; lcsKEY_MEMO_HEIGHT = 'MemoHeight'; lcsSECT_INDEX = 'Index'; lcsKEY_APIINDEX = 'APIIndex'; lcsKEY_PARAMINDEX = 'ParamIndex'; //設定読み込み。 function TApp_TOOL_APITest.FLoadIni: Boolean; var l_IniFile: TMyIniFile; begin Result := False; //Shift+Ctrl起動で設定を読み込まない。 if (gfnbKeyStateAnd([VK_SHIFT, VK_CONTROL])) then begin Exit; end; l_IniFile := nil; try l_IniFile := TMyIniFile.Create; l_IniFile.SetMonitorBoundsRect(Self); Memo_Hint.Height := l_IniFile.ReadInteger(lcsSECT_BOUNDS, lcsKEY_MEMO_HEIGHT, Memo_Hint.Height); ComboBox_API.ItemIndex := l_IniFile.ReadInteger(lcsSECT_INDEX, lcsKEY_APIINDEX, ComboBox_API.ItemIndex); ComboBox_APISelect(nil); ComboBox_APIParam.ItemIndex := l_IniFile.ReadInteger(lcsSECT_INDEX, lcsKEY_PARAMINDEX, ComboBox_APIParam.ItemIndex); ComboBox_APIParamSelect(nil); finally l_IniFile.Free; Result := True; end; // FSetConfig; end; procedure TApp_TOOL_APITest.FSaveIni; var l_IniFile: TMyIniFile; begin //Shift+Ctrl起動で設定を書き込まない。 if (gfnbKeyStateAnd([VK_SHIFT, VK_CONTROL])) then begin Exit; end; l_IniFile := nil; try l_IniFile := TMyIniFile.Create; l_IniFile.WriteBoundsRect(Self); l_IniFile.WriteInteger(lcsSECT_BOUNDS, lcsKEY_MEMO_HEIGHT, Memo_Hint.Height); l_IniFile.WriteInteger(lcsSECT_INDEX, lcsKEY_APIINDEX, ComboBox_API.ItemIndex); l_IniFile.WriteInteger(lcsSECT_INDEX, lcsKEY_PARAMINDEX, ComboBox_APIParam.ItemIndex); finally l_IniFile.Free; end; end; { procedure TApp_TOOL_APITest.FSetConfig; begin if (gfniRectWidth (G_APITestInfo.rcRect) = 0) or (gfniRectHeight(G_APITestInfo.rcRect) = 0) then begin Exit; end; gpcSetMonitorBounds(Self, G_APITestInfo.rcRect); Memo_Hint.Height := G_APITestInfo.iHintHeight; gpcDifferenceListGet(Self.ComboBox_APITest.Items, FAPITest.Items, G_APITestDiffList); ComboBox_APITest.ItemIndex := G_APITestInfo.iIndex; end; } //------------------------------------------------------------------------------ function TApp_TOOL_APITest.DoAPIInfo(hWindow: HWND; ptPos: TPoint): String; begin Result := FAPITest.Execute(ComboBox_API.Text, hWindow, ptPos, ComboBox_APIParam.ItemIndex); end; end.