Guidance
指路人
g.yi.org
software / RapidQ / Examples / Registry & INI / QIniFile - by rqwork / Test QIniFile.rqw

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $INCLUDE "Rapidq.inc"
     $INCLUDE "QIniFile.inc"

     DIM IniFile AS QIniFile

     IniFile.CreateFile(COMMAND$(0) -Application.ExeName)

     DECLARE SUB MainFormShow(Sender AS QFORM)
     DECLARE SUB MainFormClose(Action AS INTEGER)
     DECLARE SUB ReadSectionClick(Sender AS QBUTTON)
     DECLARE SUB ReadSectionsClick(Sender AS QBUTTON)
     DECLARE SUB ReadSectionValuesClick(Sender AS QBUTTON)
     DECLARE SUB ReadSectionKeysClick(Sender AS QBUTTON)
     DECLARE SUB DeleteSectionClick(Sender AS QBUTTON)
     DECLARE SUB UpdateFileClick(Sender AS QBUTTON)
     CREATE MainForm AS QFORM
      CAPTION = "MainForm"
      Top     = 131
      Left    = 217
      Width   = 459
      Height  = 280
      OnShow = MainFormShow
      OnClose = MainFormClose
     END CREATE
     CREATE ReadSection AS QBUTTON
      PARENT  = MainForm
      Top     = 16
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "Read Section"
      OnClick = ReadSectionClick
     END CREATE
     CREATE ReadSections AS QBUTTON
      PARENT  = MainForm
      Top     = 48
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "Read Sections"
      OnClick = ReadSectionsClick
     END CREATE
     CREATE ReadSectionValues AS QBUTTON
      PARENT  = MainForm
      Top     = 112
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "Read Section Values"
      OnClick = ReadSectionValuesClick
     END CREATE
     CREATE RichEdit AS QRICHEDIT
      PARENT  = MainForm
      Top     = 8
      Left    = 8
      Width   = 305
      Height  = 169
      COLOR   = &HFFFFFF
     END CREATE
     CREATE ReadSectionKeys AS QBUTTON
      PARENT  = MainForm
      Top     = 80
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "Read Section Keys"
      OnClick = ReadSectionKeysClick
     END CREATE
     CREATE DeleteSection AS QBUTTON
      PARENT  = MainForm
      Top     = 144
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "DeleteSection"
      OnClick = DeleteSectionClick
     END CREATE
     CREATE UpdateFile AS QBUTTON
      PARENT  = MainForm
      Top     = 176
      Left    = 320
      Width   = 123
      Height  = 25
      CAPTION = "UpdateFile"
      OnClick = UpdateFileClick
     END CREATE
     $INCLUDE "Minimize.inc"

     SetMinimize(MainForm)
     MainForm.SHOWMODAL

     SUB MainFormShow(Sender AS QFORM)
      MainForm.Left = IniFile.ReadInteger("MainForm","Left",0)
      MainForm.Top = IniFile.ReadInteger("MainForm","Top",0)
      MainForm.Width = IniFile.ReadInteger("MainForm","Width",459)
      MainForm.Height = IniFile.ReadInteger("MainForm","Height",219)
      MainForm.CAPTION = IniFile.ReadString("MainForm","Caption","X")
      ReadSection.Enabled = IniFile.ReadInteger("Button","Enabled",1)
     END SUB

     SUB MainFormClose(Action AS INTEGER)
      IniFile.WriteInteger("MainForm","Left",MainForm.Left)
      IniFile.WriteInteger("MainForm","Top",MainForm.Top)
      IniFile.WriteInteger("MainForm","Width",MainForm.Width)
      IniFile.WriteInteger("MainForm","Height",MainForm.Height)
      IniFile.WriteString("MainForm","Caption",MainForm.CAPTION)
      IniFile.WriteInteger("Button","Enabled",ReadSection.Enabled)
     END SUB

     SUB ReadSectionClick(Sender AS QBUTTON)
      DIM List AS QSTRINGLIST
      IniFile.ReadSection("MainForm",List)
      RichEdit.Text = List.Text
     END SUB

     SUB ReadSectionsClick(Sender AS QBUTTON)
      DIM List AS QSTRINGLIST
      IniFile.ReadSections(List)
      RichEdit.Text = List.Text
     END SUB

     SUB ReadSectionKeysClick(Sender AS QBUTTON)
      DIM List AS QSTRINGLIST
      IniFile.ReadSectionKeys("MainForm",List)
      RichEdit.Text = List.Text
     END SUB

     SUB ReadSectionValuesClick(Sender AS QBUTTON)
      DIM List AS QSTRINGLIST
      IniFile.ReadSectionValues("MainForm",List)
      RichEdit.Text = List.Text
     END SUB

     SUB DeleteSectionClick(Sender AS QBUTTON)
      IniFile.EraseSection("Button")
     END SUB

     SUB UpdateFileClick(Sender AS QBUTTON)
      IniFile.Update
     END SUB
掌柜推荐
 
 
¥860.00 ·
 
 
¥410.00 ·
 
 
¥288.00 ·
 
 
¥918.00 ·
 
 
¥288.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-03-15 10:50:50