Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Show a PasswordDlg

Posted on 1997-05-24
3
Medium Priority
?
395 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
sleach earned 80 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

721 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