前のトピック: CreateMIFString - 文字列属性の作成次のトピック: GetMIFInteger - 整数属性値の取得


GetMIFComponent または GetComponent - コンポーネント名の取得

UNIX および Windows で有効です。

GetMIFComponent または GetComponent は、既存の .MIF または Inv ファイルのコンポーネント名を取得します。

この MIF および Inv ファイル関数の形式は、以下のとおりです。

GetMIFComponent(Filename as string) as string
GetComponent(Filename as string) as string
Filename

コンポーネントを取得する MIF ファイルの名前を指定します。

この関数が正常に完了すると、コンポーネント名を含む文字列が返されます。それ以外の場合は、空の文字列が返されます。

例: GetMIFComponent 関数

注: 以下の例の初期化制御については、CreateMIFGroup の例を参照してください。

以下に、GetMIFComponent、GetMIFInteger、GetMIFString、GetMIFValue、および SetMIFValue 関数の例を示します。

Dim file, gname, aname as string
Dim gid as integer

ClrScr()
file = "h:¥test¥miffus¥file.mif"

Print("Component of """ + file + """: """ + GetMIFComponent(file) + """")

gname = "Strings"
gId = 1
aname = "string_1"
Print(gname + "." + aname + " = " + GetMIFString(file, gname, gId, aname, 1))
aname = "string_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))

if SetMIFValue(file, gname, gId, aname, 2, "Text_new") then
	Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("1. SetMIFValue failed.")
	exit
endif

gname = "Numbers"
gId = 2
aname = "number_1"
Print(gname + "." + aname + " = " + Str(GetMIFInteger(file, gname, gId, aname, 1)))
aname = "number_2"
Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
if SetMIFValue(file, gname, gId, aname, 2, "999999") then

Print(gname + "." + aname + " = " + GetMIFValue(file, gname, gId, aname, 2))
else
	Print("2. SetMIFValue failed.")
	exit
endif