Автор: mdid
Дата сообщения: 18.09.2007 12:08
есть dll
library work;
uses
SysUtils,ShellApi,Messages,Classes,Windows,Registry;
procedure WriteToReg(Programm:string;OpenK:String;Value:String);stdcall;
var
Reg : TRegistry;
begin
Reg := TRegistry.Create;
Reg.RootKey :=HKEY_CURRENT_USER;
Reg.OpenKey('\Software\BlackRose\'+programm, True);
Reg.WriteString(OpenK,Value);
Reg.CloseKey;
Reg.Free;
end;
function ReadFromReg(Programm:string;Value:String):String; stdcall;
var
Reg : TRegistry;
begin
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('\Software\BlackRose\'+programm, True);
Result:=Reg.ReadString(value);
Reg.CloseKey;
Reg.Free;
end;
exports WriteToReg,ReadFromReg;
begin
end.
есть тестовая прога
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ShellApi, StdCtrls,Registry;
type
TForm1 = class(TForm)
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
{$IFNDEF work}
procedure WriteToReg(Programm:string;OpenK:String;Value:String); stdcall;
function ReadFromReg(Programm:string;Value:String):String; stdcall;
{$ENDIF}
var
Form1: TForm1;
implementation
{$IFNDEF work}
procedure WriteToReg; external 'work.dll';
function ReadFromReg; external 'work.dll';
{$ENDIF}
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
WriteToReg('11','1','Жопа'); <- всен норм...тоесть пишет то что задано и туда куда задано
ReadFromReg('11','1'); <-invalid pointer operation
end;
нифига не пойму..де ошибка?