Guidance
指路人
g.yi.org
software / rapidq / Examples / Registry & INI / qReg.bas

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

  
'*****************************************************************************'
'START ON 22/10/2002 14:29
'-------------------------
'MADE BY : Victor Garnier (Email >> victorgarnier@ifrance.com)

'DESCRIPTION :
'This is a demo of qRegistry.

     $OPTIMIZE ON
     $TYPECHECK ON

     Application.Title = "Qregistry demo"

     $INCLUDE "rapidq.inc"

     DECLARE SUB Main()
     DECLARE SUB QuitProgram(Action AS INTEGER)
     DECLARE SUB mnuFichierClicked(Sender AS QMENUITEM)
     DECLARE SUB prg_ini(strSection AS STRING, intRead AS INTEGER)

     CREATE frmMain AS QFORM
      CREATE frmMainMenu AS QMAINMENU
       CREATE mnuFichier AS QMENUITEM
        CAPTION = "Fichier"
        CREATE mnuQuitter AS QMENUITEM
         CAPTION = "Quitter"
         OnClick = mnuFichierClicked
        END CREATE
       END CREATE
      END CREATE
      CREATE frmMainStatus AS QSTATUSBAR
       Align = alBottom
       Height = 20
      END CREATE
      OnClose = QuitProgram
     END CREATE

     SUB mnuFichierClicked(Sender AS QMENUITEM)

      SELECT CASE Sender.CAPTION
      CASE "Quitter"

       prg_ini "Screen" , False
       Application.Terminate

      END SELECT

     END SUB

     SUB QuitProgram(Action AS INTEGER)
    'we come here only if the program quits with
    'X or system menu. Don't know what action is. Always = 1
    'If someone as an idear please tell me !!!
    '---------------

      prg_ini "Screen", False
     END SUB

'*****************************************************************************'
'DESCRIPTION :  Writes and read to the registry.
'PARAMETERS :   strSection >> Witch section to write to
'               intRead >> boolean value. If true(1) Reads ini
'----
     SUB prg_ini(strSection AS STRING, intRead AS INTEGER)
      DEFSTR sKeyMainPath, screenWidth
      DIM objInit AS QREGISTRY

      sKeyMainPath = "Software\" + Application.Title
      objInit.OpenKey(sKeyMainPath, True)

      SELECT CASE strSection
      CASE "Screen"
       objInit.OpenKey("Screen", True)
       IF intRead = False THEN
        objInit.WriteInteger("ScreenWidth",frmMain.Width)
        objInit.WriteInteger("ScreenHeight",frmMain.Height)
        objInit.WriteInteger("ScreenLeft",frmMain.Left)
        objInit.WriteInteger("ScreenTop",frmMain.Top)
       ELSE
        IF objInit.ValueExists("ScreenWidth") THEN
         frmMain.Width = objInit.ReadInteger("ScreenWidth")
         frmMain.Height = objInit.ReadInteger("ScreenHeight")
         frmMain.Left = objInit.ReadInteger("ScreenLeft")
         frmMain.Top = objInit.ReadInteger("ScreenTop")
        ELSE
                'Center the form and make its initial pos.
         frmMain.Width = 640
         frmMain.Height = 480
         frmMain.Left = (Screen.width - 640) / 2
         frmMain.Top = (Screen.Height - 480) / 2
        END IF
       END IF
      END SELECT
    'go back to initial root...
      objInit.CloseKey
     END SUB
'*****************************************************************************'
     SUB Main()
      prg_ini "Screen", True                        'Retrieves the previous
                                                    'size of main window.

      frmMain.SHOWMODAL                               'Show the form
     END SUB

'BEGIN IS HERE -:)

     Main


     ------=_NextPart_000_0008_01C279F3.163326A0--
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2024-10-6  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-10-23 20:24:56