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
     
  • 相关阅读:
    程序员书单合集,持续整理中
    informatica9.5.1后最一步出错(ICMD_10033,INFACMD_10053)
    Informatica9.5.1配置域名错误(ICMD_10033,INFASETUP_10002,RSVCSHARED_00021)
    程序员书单_UML篇
    程序员书单_J2EE专题
    程序员书单_求职面试
    程序员书单_java专项进阶篇
    程序员书单_HTML篇
    程序员书单_数据结构和算法篇
    程序员书单_HeadFirst系列
  • 原文地址:https://www.cnblogs.com/topboy168/p/354125.html
Copyright © 2011-2022 走看看