Solved

Show a PasswordDlg

Posted on 1997-05-24
3
372 Views
Last Modified: 2012-06-27
I want a PasswordDlg appears immediately after form1 created.
Where I should put the statement, PasswordDlg.ShowModal?
I don't want to put it in a button Onclick event, I want that is automatically done.
I don't want to put it in the Onpaint event of form1, since whenever the form repainted PasswordDog would appear again.
0
Comment
Question by:zhuhail
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
sleach earned 40 total points
ID: 1336574
If you want the Pass Dialog shown before the form is displayed, place it in the OnCreate event of the form.

If you want the Pass Dialog shown after the form is displayed, but before the user can do anything, place it in the OnActivate method, and set a global flag so that it is only displayed the first time the event occurs.

0
 

Author Comment

by:zhuhail
ID: 1336575
Thank you.

I have tried to put PasswordDlg.ShowMadal in OnActive event of Form1. That worked fine. However, when put that in OnCreate event of Form1, I got an error message:
'Access violation at address 0041DC8F. Read of address FFFFFFFF'
What is the message means?
0
 
LVL 1

Expert Comment

by:sleach
ID: 1336576
PasswordDlg must be a delphi form.  I used a MessageBox to test.  The problem is that PasswordDlg is not the first form created.  Your main form is.  Therefore your trying to ShowModal a form that has not yet been created.

The solution is to create the PasswordDlg form at runtime.
REMOVE PasswordDlg from the projects AutoCreate list with the project manager.  Then Create the form at runtime.  An example of how to do this is below.

procedure TForm1.FormCreate(Sender: TObject);
var
PasswordDlg:  TPasswordDlg;
begin
PasswordDlg := TPasswordDlg.create(self);
PasswordDlg.ShowModal;
end;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now