• <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)論排行榜

            久久99国产综合精品女同| 久久精品国产精品亚洲| 亚洲精品乱码久久久久久中文字幕 | 欧美久久一级内射wwwwww.| 久久久久99这里有精品10| 久久天天躁狠狠躁夜夜96流白浆| 国产∨亚洲V天堂无码久久久| 久久久久一级精品亚洲国产成人综合AV区 | 亚洲精品乱码久久久久久自慰 | 午夜不卡久久精品无码免费| 老司机国内精品久久久久| 久久精品国产清自在天天线| 国产精品久久亚洲不卡动漫| 国产69精品久久久久观看软件| 996久久国产精品线观看| 精品久久久无码21p发布| 国产精品九九久久免费视频 | 日产精品99久久久久久| 欧美日韩精品久久久免费观看 | 久久九九免费高清视频| 久久狠狠高潮亚洲精品| 国产精品99久久久久久宅男小说| 国产激情久久久久影院| 精品国产乱码久久久久久1区2区| 久久亚洲精品无码aⅴ大香| 久久久久九九精品影院| 国产成人精品综合久久久| 99久久精品国产麻豆| 狠狠色婷婷久久一区二区三区| 影音先锋女人AV鲁色资源网久久| 亚洲国产精品一区二区三区久久| 精品久久久久久国产免费了| 国产精品99久久不卡| 国产精品狼人久久久久影院 | 久久精品亚洲一区二区三区浴池| 天天躁日日躁狠狠久久| 日韩精品久久久久久久电影蜜臀 | 日本精品久久久久中文字幕8| 久久99精品国产麻豆| 国产亚洲综合久久系列| 精品久久久久久中文字幕|