Форум: "Основная";
Текущий архив: 2004.08.01;
Скачать: [xml.tar.bz2];
ВнизОшибка Type в DLL Найти похожие ветки
← →
Jim^sz © (2004-07-16 18:57) [0]Я создаю DLL, в ней Type (type options=record),
и 4 функции
1: Загрузка файла ( с настройками Type)
2: Сохранение файла ( с настройками Type)
3: Применение настроек (с Type в компоненты)
4: Чтение настроек (с компонентов в Type)
И при загрузке настроек или применении их возникает ошибка
Access Volation Read of adress ...
Чё за ерунда.
type Traffic=record
SpeedINOUT: Integer;
SPEEDINFO: Integer;
ShowTime: Boolean;
FormatTime: Integer;
ShowComputer: Boolean;
ShowName: Boolean;
ShowPath: Boolean;
ShowID: Boolean;
ShowVersion: Boolean;
ShowNetProtocol: Boolean;
OnFilter: Boolean;
FormatViewBytes: integer; end;
type Progman=record
LoadFromWindows: Boolean;
PathProgram: String[255];
FolderSave: String[255];
AutoSave: Boolean;
ListItemLimit: Integer;
FormatSaveFile: Integer;
end;
type NetOptions=record
TNet: TRaffic;
TPSy: Progman;
end;
Const DFile="NSnetIUser.nec";
FIDO="NetIsUse";
var
NetXOp: TNetXOp;
XFolder: File of NetOptions;
NetUse: NetOptions;
Dir:String;
implementation
{$R *.dfm}
procedure TNetXOP.SaveFile; stdcall;
begin
try
AssignFile(XFolder, DIR+DFile);
Rewrite(XFolder);
Write(XFolder, NetUse);
CloseFile(XFolder);
except
MessageDlg("Íå óäà¸òñÿ çàïèñàòü ôàéë: ""+DIR+DFILE+"""+#10+#13+"Îøèáêà: ¹1 SaveFile@DLL", mtError, [mbOK], 0);
end;
end;
procedure TNetXOP.LoadFile; stdcall;
begin
if FileExists(Dir+DFile) then
begin
try
AssignFile(XFolder, DIR+DFile);
Reset(XFolder);
Read(XFolder, NetUse);
CloseFile(XFolder);
except
MessageDlg("Íå óäà¸òñÿ ïðî÷èòàòü ôàéë: ""+DIR+DFILE+"""+#10+#13+"Îøèáêà: ¹2 LoadFile@DLL", mtError, [mbOK], 0);
end;
end
else SaveFile;
end;
procedure TNetXOP.LoadFromWindows(Active:Boolean); stdcall;
var Reg:TRegistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey("Software\Microsoft\Windows\CurrentVersion\Run",false);
if Active then
Reg.WriteString(FIDO, NetXOp.Label10.Caption) else
Reg.DeleteValue(FIDO);
Reg.CloseKey;
Reg.Free;
end;
function TNetXop.ExistloadFromWindows:Boolean; stdcall;
var Reg:TRegistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey("Software\Microsoft\Windows\CurrentVersion\Run", false);
if Reg.ValueExists(FIDO) then Result:=true else Result:=false;
Reg.CloseKey;
Reg.Free;
end;
procedure TNetXOp.AssignOptions; stdcall;
begin
With NetXOp do
begin
NetUse.TNet.SpeedINOUT := TrackBar1.Position * 100;
NetUse.TNet.SPEEDINFO := TrackBar2.Position * 100;
NetUse.TNet.ShowTime := CheckBox1.Checked;
NetUse.TNet.FormatTime := Combobox1.ItemIndex;
NetUse.TNet.ShowComputer := CheckBox2.Checked;
NetUse.TNet.ShowName := CheckBox3.Checked;
NetUse.TNet.ShowPath := CheckBox4.Checked;
NetUse.TNet.ShowID := CheckBox5.Checked;
NetUse.TNet.ShowVersion := Checkbox6.Checked;
NetUse.TNet.ShowNetProtocol := CheckBox7.Checked;
NetUse.TNet.OnFilter := CheckBox8.Checked;
if NetUse.TNet.FormatViewBytes < 8 then NetUse.TNet.FormatViewBytes := 8;
LoadFromWindows(Checkbox9.Checked);
NetUse.TPSy.LoadFromWindows := CheckBox9.Checked;
NetUse.TPSy.PathProgram := DIR;
NetUse.TPSy.FolderSave := Edit1.Text;
NetUse.TPSy.AutoSave := CheckBox10.Checked;
NetUse.TPSy.ListItemLimit := SpinEdit1.Value;
if NetUse.TPSy.FormatSaveFile < $1F then
NetUse.TPSy.FormatSaveFile := $1F;
end;
end;
procedure TNetXOp.ReadOptions; stdcall;
begin
With NetXOP do
begin
TrackBar1.Position := NetUse.TNet.SpeedINOUT div 100;
TrackBar2.Position := NetUse.TNet.SPEEDINFO div 100;
Checkbox1.Checked := NetUse.TNet.ShowTime;
Combobox1.ItemIndex := NetUse.TNet.FormatTime;
Checkbox2.Checked := NetUse.TNet.ShowComputer;
Checkbox3.Checked := NetUse.TNet.ShowName;
Checkbox4.Checked := NetUse.TNet.ShowPath;
Checkbox5.Checked := NetUse.TNet.ShowID;
Checkbox6.Checked := NetUse.TNet.ShowVersion;
Checkbox7.Checked := NetUse.TNet.ShowNetProtocol;
Checkbox8.Checked := NetUse.TNet.OnFilter;
case NetUse.TNet.FormatViewBytes of
8: RadioButton1.Checked := true;
16: RadioButton2.Checked := true;
32: RadioButton3.Checked := true;
64: RadioButton4.Checked := true;
end;
Checkbox9.Checked := ExistloadFromWindows;
NetXop.Edit1.Text := NetUse.TPSy.FolderSave;
CheckBox10.Checked := NetUse.TPSy.AutoSave;
SpinEdit1.Value := NetUse.TPSy.ListItemLimit;
Case NetUse.TPSy.FormatSaveFile of
$1F: RadioButton5.Checked := true;
$2F: RadioButton6.Checked := true;
end;
end;
end;
//==============================================================================
procedure TNetXOp.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TNetXOp.TrackBar1Change(Sender: TObject);
begin
Label2.Caption := Inttostr(100*TrackBar1.Position)+ " ñ.ñ";
end;
procedure TNetXOp.TrackBar2Change(Sender: TObject);
begin
Label4.Caption := Inttostr(100*TrackBar2.Position)+ " ñ.ñ";
end;
procedure TNetXOp.Button3Click(Sender: TObject);
begin
BR.Execute;
if (Trim(BR.FolderName)<>"") and
(DirectoryExists(BR.FolderName)) then Edit1.Text := BR.FolderName else
Edit1.Text := DIR;
end;
procedure TNetXOp.CheckBox10Click(Sender: TObject);
begin
if Checkbox10.Checked then
SpinEdit1.Enabled := true else
SpinEdit1.Enabled := false;
end;
procedure TNetXOp.RadioButton1Click(Sender: TObject);
begin
NetUse.TNet.FormatViewBytes := 8;
end;
procedure TNetXOp.RadioButton2Click(Sender: TObject);
begin
NetUse.TNet.FormatViewBytes := 16;
end;
procedure TNetXOp.RadioButton3Click(Sender: TObject);
begin
NetUse.TNet.FormatViewBytes := 32;
end;
procedure TNetXOp.RadioButton4Click(Sender: TObject);
begin
NetUse.TNet.FormatViewBytes := 64;
end;
procedure TNetXOp.RadioButton5Click(Sender: TObject);
begin
NetUse.TPSy.FormatSaveFile := $1F;
end;
procedure TNetXOp.RadioButton6Click(Sender: TObject);
begin
NetUse.TPSy.FormatSaveFile := $2F;
end;
procedure TNetXOp.Button2Click(Sender: TObject);
begin
AssignOptions;
SaveFile;
Button1.Click;
end;
procedure TNetXOp.FormActivate(Sender: TObject);
begin
Dir:= Label9.Caption;
LoadFile;
ReadOptions;
end;
end.
← →
Fay © (2004-07-16 19:04) [1]Ужасно
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2004.08.01;
Скачать: [xml.tar.bz2];
Память: 0.47 MB
Время: 0.034 c