程序描述:
form1为一个登录界面,当checkbox1.checked 选中时,输入密码正确就可以进入form7;checkbox1未选中时,输入密码正确进入form6。
问题描述:
总是出现“violation at address 0046f692 in module 'roject1.ext'.read of address 000002f4'”提示,我也找不出代码那里有问题,用step能看到出现问题的地方为下面星号标注处。
还有一个问题,
Application.Initialize;是什么作用,和vb中的一样么,我看到一些文章说,vb中的相当于delphi中的create,那delphi中的Application.Initialize;是做什么用的,谢谢大家。(分不够我可以另加)
project1 代码
program Project1;{%File 'Project1.~dpr'}
{%File 'Project1.cfg'}
{%File 'Project1.dof'}
{%File 'Project1.exe'}uses
Forms,
Unit100 in 'Unit100.pas' {Form1},
Unit101 in 'Unit101.pas' {QueryDS: TDataModule},
Unit102 in 'Unit102.pas' {Form2},
Unit103 in 'Unit103.pas' {Form3},
Unit104 in 'Unit104.pas' {Form4},
Unit105 in 'Unit105.pas' {Form5},
Unit106 in 'Unit106.pas' {Form6},
Unit107 in 'Unit107.pas' {Form7},
Unit108 in 'Unit108.pas' {Form8},
Unit109 in 'Unit109.pas' {Form9},
Unit1100 in 'Unit1100.pas' {Form10};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
if form1.CheckBox1.Checked=False then
begin
Application.CreateForm(TForm7,Form7);
Application.CreateForm(TQueryDS,QueryDS);
Application.CreateForm(TForm4,Form4);
Application.CreateForm(TForm5,Form5);
Application.Run;
end
else
begin
Application.CreateForm(TForm6,Form6);
Application.CreateForm(TForm2,Form2);
Application.CreateForm(TForm3,Form3);
Application.CreateForm(TQueryDS,QueryDS);
Application.CreateForm(TForm8,Form8);
Application.CreateForm(TForm9,Form9);
Application.CreateForm(TForm10,Form10);
Application.Run;
end;end.
form1代码unit Unit100;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
Times:Integer=0;implementation{$R *.dfm}
uses unit106,unit107;
procedure TForm1.Button1Click(Sender: TObject); var
pwdFile:textfile;
pwdStr:string;
begin if CheckBox1.Checked=true then assignfile(pwdFile,'E:\typer\dephi程序员\图书馆管理系统\data\管理员.txt')
else assignfile(pwdFile,'E:\typer\dephi程序员\图书馆管理系统\data\学生.txt');
reset(pwdFile);
readln(pwdFile,pwdStr);
closefile(pwdFile);
Times:=Times+1;
if Edit1.Text=pwdStr then
begin
if CheckBox1.Checked=true then Form6.Show
else Form7.Show;
end
else
begin
if MessageDlg('密码输入错误,是否退出?',mtConfirmation,[mbYes,mbNo],0)=mrYes then close
else if Times<3 then edit1.SetFocus
else
begin
MessageDlg('密码严重错误,退出。',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
end;end.
form1为一个登录界面,当checkbox1.checked 选中时,输入密码正确就可以进入form7;checkbox1未选中时,输入密码正确进入form6。
问题描述:
总是出现“violation at address 0046f692 in module 'roject1.ext'.read of address 000002f4'”提示,我也找不出代码那里有问题,用step能看到出现问题的地方为下面星号标注处。
还有一个问题,
Application.Initialize;是什么作用,和vb中的一样么,我看到一些文章说,vb中的相当于delphi中的create,那delphi中的Application.Initialize;是做什么用的,谢谢大家。(分不够我可以另加)
project1 代码
program Project1;{%File 'Project1.~dpr'}
{%File 'Project1.cfg'}
{%File 'Project1.dof'}
{%File 'Project1.exe'}uses
Forms,
Unit100 in 'Unit100.pas' {Form1},
Unit101 in 'Unit101.pas' {QueryDS: TDataModule},
Unit102 in 'Unit102.pas' {Form2},
Unit103 in 'Unit103.pas' {Form3},
Unit104 in 'Unit104.pas' {Form4},
Unit105 in 'Unit105.pas' {Form5},
Unit106 in 'Unit106.pas' {Form6},
Unit107 in 'Unit107.pas' {Form7},
Unit108 in 'Unit108.pas' {Form8},
Unit109 in 'Unit109.pas' {Form9},
Unit1100 in 'Unit1100.pas' {Form10};{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
if form1.CheckBox1.Checked=False then
begin
Application.CreateForm(TForm7,Form7);
Application.CreateForm(TQueryDS,QueryDS);
Application.CreateForm(TForm4,Form4);
Application.CreateForm(TForm5,Form5);
Application.Run;
end
else
begin
Application.CreateForm(TForm6,Form6);
Application.CreateForm(TForm2,Form2);
Application.CreateForm(TForm3,Form3);
Application.CreateForm(TQueryDS,QueryDS);
Application.CreateForm(TForm8,Form8);
Application.CreateForm(TForm9,Form9);
Application.CreateForm(TForm10,Form10);
Application.Run;
end;end.
form1代码unit Unit100;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
Times:Integer=0;implementation{$R *.dfm}
uses unit106,unit107;
procedure TForm1.Button1Click(Sender: TObject); var
pwdFile:textfile;
pwdStr:string;
begin if CheckBox1.Checked=true then assignfile(pwdFile,'E:\typer\dephi程序员\图书馆管理系统\data\管理员.txt')
else assignfile(pwdFile,'E:\typer\dephi程序员\图书馆管理系统\data\学生.txt');
reset(pwdFile);
readln(pwdFile,pwdStr);
closefile(pwdFile);
Times:=Times+1;
if Edit1.Text=pwdStr then
begin
if CheckBox1.Checked=true then Form6.Show
else Form7.Show;
end
else
begin
if MessageDlg('密码输入错误,是否退出?',mtConfirmation,[mbYes,mbNo],0)=mrYes then close
else if Times<3 then edit1.SetFocus
else
begin
MessageDlg('密码严重错误,退出。',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
end;end.
解决方案 »
- 关于实习的问题,请教一下各位前辈
- GlobalFindAtom这个函数有怎么用的?
- 接口编程 Interface如何转换成类变量
- 如何释放sndPlaySound占用的内存?
- 哪有ERP示范软件可下载参观?
- 但怎样实现用SQL语句将一个查询的集导导出到EXCEL文件中啊?
- 在线等:delphi 中,如何得到SQL的当前用户ID
- 我想启动delphi快一些便建立快捷方式delphi目录\delphi32.exe -ns -np可提示说不能这样建立大家帮我!!!!
- Delphi的文件版本管理不好。
- 怎样从一个应用程序某一个form的Name得到该Form的实例,
- 如何取局网和公网的服务器时间
- 如何将Excel的数据调入到Dbgrid中显示?
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm7,Form7);
Application.CreateForm(TQueryDS,QueryDS);
Application.CreateForm(TForm4,Form4);
Application.CreateForm(TForm5,Form5);
Application.CreateForm(TForm6,Form6);
Application.CreateForm(TForm2,Form2);
Application.CreateForm(TForm3,Form3);
Application.CreateForm(TForm8,Form8);
Application.CreateForm(TForm9,Form9);
Application.CreateForm(TForm10,Form10);
Application.Run;
end.
Application.CreateForm(TForm10,Form10);
Application.Run;
end;
修改成如下:
Application.CreateForm(TForm10,Form10);
end;
Application.Run;
begin
if CheckBox1.Checked=true then Form6.Show
else Form7.Show;
end
這裹出問題, 窗體還沒創建就 show!!!
只有一个情况,所以只有一个form6,or fmor7能创建,你显示的时候没创建就出错了开始的时候全部创建算了,管他干嘛
Application.Initialize;
系统初始化,由系统控制,不用理他
在project代码中一定要把这些窗体都包括到里面么。
如果我的project代码中还是用到选择语句,能不能实现。
有没有哪位知道Application.Initialize的作用。