# Re: 读取 .INI 档案

Posted by Booker Hsu on July 06, 1999 at 17:24:48:

In Reply to: 读取 .INI 档案 posted by Rex on July 06, 1999 at 15:00:28:

: 请问VB有没有读取INI档的函数或物件?

可以 CALL API FUNCTION ..

Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nsize As Long, ByVal lpFileName As String) As Long

retlen = GetPrivateProfileString(ByVal "SET", ByVal "IP1", "10.1.21.250", ret_string, 80, App.Path + "\init.ini ")
IP1 = Left(ret_string, retlen)

>>init.ini 如下:

[SET]
IP1 = 10.1.21.250
PORT1 = 10652

或上网DOWNLOAD OCX ..

Follow Ups:

- 参考这里,建立与读取.ini dino 15:50:19 7/09/99 (0)
- 有的!!! 只是... 纪文和 23:32:53 7/06/99 (0)