Dear all,
I have a program that first gives a password. If the user was accepted my menu be appear and if not I want to quit. But I can not do this.
Please help me.
here is my code:
*-- Application Settings
ON SHUTDOWN Do AppExit
*-- Demo main program.
PRIVATE oMainObject
oMainObject = CREATEOBJECT("MainObject")
READ EVENTS
RETURN .T.
DEFINE CLASS MainObject as Custom
*-- Define Properties.
DECLARE aToolBars[11,2] && Toolbar collection.
cAppRoot = "" && Application Root directory.
cBmpsDir = "" && Bmps directory
cClassesDir = "" && Classes directory.
cDataDir = "" && Data Directory.
cFormsDir = "" && Forms Directory.
cPrgsDir = "" && Programs Directory.
cReportsDir = "" && Reports Directory.
cScreenCaption = _Screen.Caption
PROCEDURE Init
_Screen.LockScreen = .T.
LOCAL lcRunDir
SET FULLPATH ON
WITH This
.cAppRoot = ADDBS(JUSTPATH(FULLPATH(SYS(16,1)))) && Application Root directory.
.cBmpsDir = .cAppRoot + "BMPS\" && Bmps directory.
.cClassesDir = .cAppRoot + "CLASSES\" && Classes directory.
.cDataDir = .cAppRoot + "DATA\" && Data Directory.
.cFormsDir = .cAppRoot + "FORMS\" && Forms Directory.
.cPrgsDir = .cAppRoot + "PROGRAMS\" && Programs Directory.
.cReportsDir = .cAppRoot + "REPORTS\" && Reports Directory.
ENDWITH
This.ReleaseToolBars()
SET SYSMENU off
_Screen.Icon = This.cBmpsDir + "BOOK.ICO"
_Screen.RightToLeft = .T.
_Screen.WindowState = 2
_Screen.LockScreen = .F.
DO FORM password.scx TO AcceptUser
IF AcceptUser
This.DefineMenu()
ELSE
******???????
* here if he/she must exit from program , what must i write?
ENDIF
ENDPROC
PROCEDURE Destroy
This.RestoreToolBars()
SET SYSMENU TO DEFAULT
SET SYSMENU TO LTRJUSTIFY
_Screen.Icon = ""
_Screen.Caption = This.cScreenCaption
_Screen.RightToLeft = .F.
ENDPROC
PROCEDURE ReleaseToolBars
LOCAL lnToolBar
WITH This
.aToolBars[1,1] = "Form Designer"
.aToolBars[2,1] = "Standard"
.aToolBars[3,1] = "Layout"
.aToolBars[4,1] = "Query Designer"
.aToolBars[5,1] = "View Designer"
.aToolBars[6,1] = "Color Palette"
.aToolBars[7,1] = "Form Controls"
.aToolBars[8,1] = "Database Designer"
.aToolBars[9,1] = "Report Designer"
.aToolBars[10,1] = "Report Controls"
.aToolBars[11,1] = "Print Preview"
FOR lnToolBar = 1 TO ALEN(.aToolBars, 1)
.aToolBars[lnToolBar,2] = WVISIBLE(.aToolBars[lnToolBar,1])
IF .aToolBars[lnToolBar,2]
HIDE WINDOW (.aToolBars[lnToolBar,1])
ENDIF
ENDFOR
ENDWITH
ENDPROC
PROCEDURE RestoreToolBars
LOCAL lnToolBar
FOR lnToolBar = 1 TO ALEN(THIS.aToolBars, 1)
IF This.aToolBars[lnToolBar,2]
SHOW WINDOW (This.aToolBars[lnToolBar,1])
ENDIF
ENDFOR
ENDPROC
PROCEDURE DefineMenu
*-- Reset the System menu.
SET SYSMENU TO
SET SYSMENU AUTOMATIC
ON KEY LABEL ESC KEYBOARD CHR(13)
*-- Define My menu pads.
SET SYSMENU TO RTLJUSTIFY
ON KEY LABEL ESC
ENDPROC
ENDDEFINE
PROCEDURE AppExit
CLEAR EVENTS
oMainObject = .NULL.
ON SHUTDOWN
*QUIT
ENDPROC
Thanks
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only