writeini.prg

来自「产品合格证标签打印源码」· PRG 代码 · 共 24 行

PRG
24
字号
******************
*Function WriteINI
******************
*!* This function reads an application INI file. Each of the strings below must end in a Null
*!* character  - CHR(0). It is also important to use the @ to ensure that lcReturned is passed by reference.
*!*	lcFile - Name of the INI file
*!*	lcSection - Section in the INI file
*!*	lcKey - Key in the INI file
*!*	lcString - Value to be assigned to the key
***=writeini(CURDIR() +"txgl.ini", "user", "user1", "崔万军")
LPARAMETER lcFile, lcSection, lcKey, lcString
LOCAL lnResult
IF TYPE("lcFile") # "C" OR TYPE("lcSection") # "C" OR TYPE("lcKey") # "C" OR TYPE("lcString") # "C"
	RETURN .F.
ENDIF
Declare Integer WritePrivateProfileString IN WIN32API String, String, String, String
lcSection = lcSection + IIF(RIGHT(lcSection,1) = CHR(0),"",CHR(0))
lcKey = lcKey + IIF(RIGHT(lcKey,1) = CHR(0),"",CHR(0))
lcString = lcString + IIF(RIGHT(lcString,1) = CHR(0),"",CHR(0))
lcFile = lcFile + IIF(RIGHT(lcFile,1) = CHR(0),"",CHR(0))
lnResult = WritePrivateProfileString(lcSection,lcKey,lcString,lcFile)
CLEAR DLLS WritePrivateProfileString
RETURN IIF(lnResult=1,.T.,.F.)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?