• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            JS讀寫(xiě)ini文件






            //////////////////////////////////////////////////////////////////////////////////////
            function print(){
            fso = new ActiveXObject("Scripting.FileSystemObject");
            tf = fso.CreateTextFile("E:\\test.ini", true); 
            tf.WriteLine("要寫(xiě)入的內(nèi)容");
            tf.Close();
            }
            /////////////////////////////////////////////////////////////////////////////////////

            using System;
            using System.Runtime.InteropServices;
            using System.Text;
            using System.IO;

            namespace Common
            {
                /// <summary>
                /// INI文件讀寫(xiě)類。
                /// </summary>
             public class INIFile
             {
              public string path;

              public INIFile(string INIPath)
              {
               path = INIPath;
              }

              [DllImport("kernel32")]
              private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);

              [DllImport("kernel32")]
              private static extern int GetPrivateProfileString(string section,string key,string def, StringBuilder retVal,int size,string filePath);

             
              [DllImport("kernel32")]
              private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath);


              /// <summary>
              /// 寫(xiě)INI文件
              /// </summary>
              /// <param name="Section"></param>
              /// <param name="Key"></param>
              /// <param name="Value"></param>
              public void IniWriteValue(string Section,string Key,string Value)
              {
               WritePrivateProfileString(Section,Key,Value,this.path);
              }

              /// <summary>
              /// 讀取INI文件
              /// </summary>
              /// <param name="Section"></param>
              /// <param name="Key"></param>
              /// <returns></returns>
              public string IniReadValue(string Section,string Key)
              {
               StringBuilder temp = new StringBuilder(255);
               int i = GetPrivateProfileString(Section,Key,"",temp, 255, this.path);
               return temp.ToString();
              }
              public byte[] IniReadValues(string section, string key)
              {
               byte[] temp = new byte[255];
               int i = GetPrivateProfileString(section, key, "", temp, 255, this.path);
               return temp;

              }


              /// <summary>
              /// 刪除ini文件下所有段落
              /// </summary>
              public void ClearAllSection()
              {
               IniWriteValue(null,null,null);
              }
              /// <summary>
              /// 刪除ini文件下personal段落下的所有鍵
              /// </summary>
              /// <param name="Section"></param>
              public void ClearSection(string Section)
              {
               IniWriteValue(Section,null,null);
              }

             }


            }

            posted on 2010-10-20 11:21 wrh 閱讀(3374) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            導(dǎo)航

            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            統(tǒng)計(jì)

            常用鏈接

            留言簿(19)

            隨筆檔案

            文章檔案

            收藏夾

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            成人午夜精品久久久久久久小说| 久久性生大片免费观看性| 日本WV一本一道久久香蕉| 伊人久久无码中文字幕| 国产亚洲精品自在久久| 精品水蜜桃久久久久久久| 99精品久久久久久久婷婷| 久久人人爽人人爽人人片av高请| 香港aa三级久久三级| 99久久香蕉国产线看观香| 热久久国产精品| 伊人久久精品无码二区麻豆| 一本久久a久久精品综合夜夜| 一级做a爰片久久毛片免费陪| 久久精品国产99久久久| 亚洲国产成人精品91久久久 | 99久久成人18免费网站| 2020久久精品亚洲热综合一本| 成人免费网站久久久| 久久人人添人人爽添人人片牛牛| 亚洲综合久久综合激情久久| 亚洲午夜无码久久久久| 久久久久国产成人精品亚洲午夜| 精品无码久久久久国产| 久久婷婷五月综合97色一本一本| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久亚洲精品国产精品| 久久无码中文字幕东京热| 久久综合久久性久99毛片| 国产福利电影一区二区三区久久久久成人精品综合 | 久久久久久久91精品免费观看| 精品乱码久久久久久久| 色综合久久久久久久久五月| 久久精品中文字幕大胸| 性做久久久久久久久久久| 久久精品亚洲男人的天堂| 国产一区二区三精品久久久无广告| 久久99精品久久久久婷婷| 99久久精品费精品国产一区二区 | 久久er99热精品一区二区| 久久久久久久人妻无码中文字幕爆|