readini.prg

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

PRG
30
字号
******************
*Function ReadINI
******************
*!* 此函数的功能是从指定的INI文件中读取数据。
*!* character  - CHR(0). It is also important to use the @ to ensure that lcReturned is passed by reference.
*!*	lcSection  - INI 文件中的段名
*!*	lcKey - INI文件中的主键名称
*!*	lcFile - INI文件的路径及文件名
*!*	lcDefault - Default message if the function fails
*!*	lcReturned - Memory variable that holds the return string
*!*	liSize - Size of the memvar lcReturned
*!*	lnSize - Number of bytes in the string returned.
***?READini(CURDIR() +"txgl.ini", "user", "user1")
LPARAMETER lcFile, lcSection, lcKey
LOCAL lcDefault, lcReturned, liSize, lnSize
IF TYPE("lcSection") # "C" OR TYPE("lcKey") # "C" OR TYPE("lcFile") # "C"
	RETURN ""
ENDIF
lcSection = lcSection + IIF(RIGHT(lcSection,1) = CHR(0),"",CHR(0))
lcKey = lcKey + IIF(RIGHT(lcKey,1) = CHR(0),"",CHR(0))
lcDefault = "" + CHR(0)
lcReturned = SPACE(5120) + CHR(0)
liSize = 5120
lcFile = lcFile + IIF(RIGHT(lcFile,1) = CHR(0),"",CHR(0))
Declare Integer GetPrivateProfileString IN WIN32API String, String, String, string@, Integer, String
lnSize = GetPrivateProfileString(lcSection,lcKey,lcDefault,@lcReturned,liSize,lcFile)
lcReturned = LEFT(lcReturned,lnSize)
CLEAR DLLS GetPrivateProfileString
RETURN lcReturned

⌨️ 快捷键说明

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