ini.abp を作成します。
>新規作成
->Basicプログラム(*.abp *.bas)
->プロジェクトへ追加をチェック
->ファイル名は ini

中はこれ。


Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (

	pSectionName As BytePtr,

	pKeyName As BytePtr,

	nDefault As Long,

	pProfileName As BytePtr

) As Long



Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (

	pSectionName As BytePtr,

	pBuffer As BytePtr,

	nBufferLength As Dword,

	pProfileName As BytePtr

) As Dword



Declare Function GetPrivateProfileSectionNames Lib "kernel32" Alias "GetPrivateProfileSectionNamesA" (

	pBuffer As BytePtr,

	nBufferLength As Dword,

	pProfileName As BytePtr

) As Dword



Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (

	pSectionName As BytePtr,

	pKeyName As BytePtr,

	pDefault As BytePtr,

	pBuffer As BytePtr,

	nBufferLength As Dword,

	pProfileName As BytePtr

) As Dword



Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (

	pSectionName As BytePtr,

	pString As BytePtr,

	pProfileName As BytePtr

) As Long



Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (

	pSectionName As BytePtr,

	pKeyName As BytePtr,

	pString As BytePtr,

	pProfileName As BytePtr

) As Long





'INIファイルから読み込み

Sub GetINIParameter( lpFile As String )

	gPosNum = GetPrivateProfileInt("Pos","Seg",3,lpFile )

	gRingNum = GetPrivateProfileInt("Pos","Ring",1,lpFile )

	gSpeed = GetPrivateProfileInt("Pos","Speed",5,lpFile )

	gR = GetPrivateProfileInt("Pos","R",128,lpFile )

	gG = GetPrivateProfileInt("Pos","G",128,lpFile )

	gB = GetPrivateProfileInt("Pos","B",128,lpFile )

End Sub



'INIファイルに設定

Sub SetINIParameter( lpFile As String )

	Dim	StrNum As String

	StrNum = Str$( gPosNum )

	WritePrivateProfileString("Pos","Seg",StrNum, lpFile)

	StrNum = Str$( gRingNum )

	WritePrivateProfileString("Pos","Ring",StrNum, lpFile)

	StrNum = Str$( gSpeed )

	WritePrivateProfileString("Pos","Speed",StrNum, lpFile)

	StrNum = Str$( gR )

	WritePrivateProfileString("Pos","R",StrNum, lpFile)

	StrNum = Str$( gG )

	WritePrivateProfileString("Pos","G",StrNum, lpFile)

	StrNum = Str$( gB )

	WritePrivateProfileString("Pos","B",StrNum, lpFile)

End Sub

設定をiniファイルに保存したり読み込んだりします。
iniファイルはWINDOWSフォルダに作られたりします。

次へ


back