Tim,
The third example should not have had the PUBLIC line at all.
Here's the issue about the public var again. I like to run my project by DOing the start up prg and then letting it return to teh command window so I can use the form designer and make changes while the app is running. To do this I declare the Application object's memvar as public and don't issue a READ EVENTS so the start up prg will end but the oApp var stays in scope. Similar to the following;
* Startup.prg
LPARAMETERS llDevopment
IF llDevelopment
PUBLIC oApp
ENDIF
oApp = NewObject("Application","System")
IF NOT llDevlopment
READ EVENTS
ENDIF
* End startup.prg
This way if I DO Startup WITH .T. the var oApp is declared PUBLIC and the startup program termintates after creating the application object. I am returned to teh command window and can use any development tools that I choose while the app is running.
If I don't pass the parameter then the value of llDevelopment is .F. and the var is private (default) and a READ EVENTS is issued.