zoukankan      html  css  js  c++  java
  • ini文件的读取

    控件:TEXT 3    COMMAND 2
    '主窗口代码
    '变量:success   ret    buff   rs 
    '
    '
    '
    ****************************************************************************
     
    Option Explicit
     
    Private Sub Command1_Click()
    Dim success As Long
    dim success1 as long
    dim success2 as long
    Dim ret As Long
    Dim buff As String
    Dim rs As String
    buff = String(255, 0)
    success = WritePrivateProfileString("MyApp", "text1", Text1.Text, "c:\aa.ini")
    success=WritePrivateProfileString("App", "text1", Text1.Text, "c:\aa.ini")
    End Sub

    Private Sub Command2_Click()
    Dim rs As String
    Dim buff As String
    Dim ret As Long
    buff = String(255, 0)
    ret = GetPrivateProfileString("Myapp", "text1", "hello", buff, 256, "c:\aa.ini")
    MsgBox buff
    Shell buff, 1
    End Sub
    Private Sub form_load()
    Dim ret As Long
    Dim buff As String
    Dim rs As String
    buff = String(255, 0)
    ret = GetPrivateProfileString("Myapp", "text1", "fx1", buff, 256, "c:\aa.ini")
    MsgBox buff
    buff = String(255, 0)
    ret = GetPrivateProfileString("app", "text2", "fx2", buff, 256, "c:\aa.ini")
    Text2.Text = buff
    buff = String(255, 0)
    ret = GetPrivateProfileString("app2", "text3", "fx3", buff, 256, "c:\aa.ini")
    Text3.Text = buff
    End Sub
     
    *****************************************************************************
    '标准模块中 代码
    'API GetPrivateProfileString 
    '     WritePrivateProfileString
    '
    '
    ****************************************************************************
    Option Explicit
    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

    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
     
  • 相关阅读:
    python基础--py2与py3编码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
  • 原文地址:https://www.cnblogs.com/topboy168/p/354125.html
Copyright © 2011-2022 走看看