[HELP]How to use PreRealize setup function in startup??

I try to make a login window before the main window in my application. Then I choose “Application->Startup Info/Module” and select the right main window in “windows displayed on Application startup” , edit setup function as “winstart” with option “Call function on PreRealize”.
The main part of code looks like that:
PtPassword(ABW_mainwindow,NULL,“confirm password”,NULL,“input your password”,NULL,NULL,NULL,NULL,&validate,“data”,NULL,Pt_CENTER);

When run this application, nothing can be displayed at all!
If I change the option to “Call function on PostRealize”, then mainwindow shows first followed by the password dialog.
Can you tell me how to display password dialog before any window display in an application just like the Photon login window? Thx a lot!