$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)
prg_ini "Screen", False
END SUB
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
frmMain.Width = 640
frmMain.Height = 480
frmMain.Left = (Screen.width - 640) / 2
frmMain.Top = (Screen.Height - 480) / 2
END IF
END IF
END SELECT
objInit.CloseKey
END SUB
SUB Main()
prg_ini "Screen", True
frmMain.SHOWMODAL
END SUB
Main
------=_NextPart_000_0008_01C279F3.163326A0--
|