Syntax 1: For the application object
Description
Occurs when the user starts the application.
Event ID
|
Event ID |
Objects |
|---|---|
|
None |
Application |
Arguments
|
Argument |
Description |
|---|---|
|
commandline |
String by value. Additional arguments are included |
Return Values
None (do not use a RETURN statement)
Usage
This event can establish database connection parameters and open
the main window of the application.
On Windows
You can specify command line arguments when you use the Run
command from the Start menu or as part of the Target specification
when you define a shortcut for your application.
There is no way to specify command line values when you are
testing your application in the development environment.
In other events and functions, you can call the CommandParm
function to get the command line arguments.
For an example of parsing the string in commandline, see CommandParm.
Examples
This example populates the SQLCA global variable from the
application’s initialization file, connects to the database, and opens
the main window:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* Populate SQLCA from current myapp.ini settings */ SQLCA.DBMS = ProfileString("myapp.ini", "database", & "dbms", "") SQLCA.Database = ProfileString("myapp.ini", & "database", "database", "") SQLCA.Userid = ProfileString("myapp.ini", "database", & "userid", "") SQLCA.DBPass = ProfileString("myapp.ini", "database", & "dbpass", "") SQLCA.Logid = ProfileString("myapp.ini", "database", & "logid", "") SQLCA.Logpass = ProfileString("myapp.ini", & "database", "LogPassWord", "") SQLCA.Servername = ProfileString("myapp.ini", & "database", "servername", "") SQLCA.DBParm = ProfileString("myapp.ini", "database", & "dbparm", "") CONNECT; IF SQLCA.Sqlcode <> 0 THEN MessageBox("Cannot Connect to Database", & SQLCA.SQLErrText) RETURN END IF /* Open MDI frame window */ Open(w_genapp_frame) |
See also