Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Stefan Wuebbe
 To: Ulhas Amrite
  Where is Ulhas Amrite?
 Ulhas Amrite
Subject: RE: Things reqd for My appliaction
Thread ID: 189106 Message ID: 189120 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Classes and Objects
Date: Wednesday, August 13, 2008 1:05:01 PM         

Hi Ulhas -

> Dear friends,
> Please help me for following
> 1) I want to display a splash screen for my application
> 2) I want a background picture on screen as water mark
> 3) I want to disable second instance of my application on the same machine.
> 4) I want to close the application by selecting exit from the menu as well as by clicking the [X] on the title bar of the application.
> 5) When I want to perform some development work I want to give a warning to the existing users that the system will shut down after some (say 1 minute) time and disallow new users to log in to the system.
> I already have implemented item 1 thru 4 for my application.
> I feel for 4th I need to have a top level form containing menu and I am unable to put all things together

At which point do you have problems and what problems exactly? - actually my impression is that each of your points might deserve an own thread ...

> I am using following codes
> For item 1- a form class named splash is in class-lib “sur_clsl”
> _SCREEN.VISIBLE = .F. && Hide main vfp window

You would not need this line when you'd use a config.fpw containing a line "screen=off" (w/o quotes) - works better because otherwise you'll see _screen for a short moment at startup.

> LOCAL loform
> loform = NEWOBJECT("_splash", "..\amrite\classes\sur_clsl")
> IF VARTYPE(loform) # "O"
> loform.SHOW() && display splash screen
> _SCREEN.VISIBLE = .t. && Hide main vfp window

This part works OK for you? If not, it might depend on your class properties - since you have _screen.Visible=.F. at that point, your class should have .ShowWindow=2
Do you Hide() or Release() the splash screen somewhere later?

> for Item 2
> either _screen.picture = “mypicture.jpg”
> or if top level form this.image1.picture = “mypicture.jpg”

This part works OK for you?
If not, does an Image control addObject'ed to _screen look better? You could move it programmatically and set its Anchor property.

PS: No, you are using VFP6 without any Anchoring features :-)
Post back if you want to hook into _screen.Resize() in Vfp6.

> for Item 3 the code is available on following url
> https://www.netacademia.net/tudastar/default.aspx?upid=11227

Any problems at that point?

> for Item 4
ON SHUTDOWN DO realquit IN ..\amrite\programs\std_proc		&& exit
> PROCEDURE realquit	&& lcmyname obtained in scaffold.prg from admin.dbf
> IF MESSAGEBOX([Exit from "] + TRIM(lcmyname) + [" System?], 4+32+256, "System Exit") = 6
> 	use suryalog shared
> 	delete for upper(machine) = left(upper(sys(0)),10) and trim(UPPER(user)) = trim(UPPER(loguser))

Does an additional "On Shutdown" line inside the procedure improve its behavior?

However, I believe you are doing too much here - if you'd let each object.QueryUnload() / Destroy() care for itself, a simple "On Shutdown quit" might be enough.
Additionally, I'd guess that would solve the assumed problem that when your application runs and you try to shut down Windows or Log Off the current Windows user without closing your application before, then the Windows Log Off would not work on the first attempt, wouldn't it?

> for item 5 – I use a class “timershut” based on “timer” code is below
IF m.pnshutseconds = 0
> 	IF FILE("DoShut.txt")
> 		m.pnshutseconds = VAL(FILETOSTR("DoShut.txt"))
> 		m.ptshuttime = DATETIME()+VAL(FILETOSTR("DoShut.txt"))
> IF m.pnshutseconds > 0
> 	WAIT WINDOW "Maintenance shutdown called by " + ;
> 		"system administrator" + CHR(13)+ ;
> 		"please close down your application before " + ;
> 		"the forced shutdown."+ CHR(13)+ CHR(13)+;
> 		"shutdown time "+TTOC(m.ptshuttime) + CHR(13)+ ;
> 		"current time is "+TTOC(DATETIME()) NOWAIT NOCLEAR
> 	IF DATETIME() > m.ptshuttime

Does that part work as expected? Do you or any admin create and delete delete the doshut.txt file manually?



Things reqd for My appliaction Posted by Ulhas Amrite @ 8/13/2008 12:24:33 PM
RE: Things reqd for My appliaction Posted by Stefan Wuebbe @ 8/13/2008 1:05:01 PM
RE: Things reqd for My appliaction Posted by Ulhas Amrite @ 8/13/2008 4:39:28 PM
RE: Things reqd for My appliaction Posted by Anil Sharma @ 8/13/2008 7:52:28 PM
RE: Things reqd for My appliaction Posted by Stefan Wuebbe @ 8/13/2008 7:42:52 PM
RE: Things reqd for My appliaction Posted by Yousfi Benameur @ 8/14/2008 3:47:08 AM