M
Marlowe
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一组函数,放在Unit里运行没问题,可放在DLL中,再从程序中调用
就报错(说指针使用不正确).
请诸位帮忙看看。
<另外,我用Delphi也几年了,应该不会犯太简单的错误>
下面是源码
function ReadValue (Path , ValueName : string ) : string
export;
var
Reg : Tregistry;
begin
if Length (Path) =0 then
begin
Result := '';
exit;
end;
try
reg := Tregistry.create;
Reg.RootKey := HKey_Local_machine;
if (Reg.OpenKey (Path,False)) and (ValueName<>'') then
Result := Reg.ReadString(ValueName);
finally
Reg.Free;
end;
end;
就报错(说指针使用不正确).
请诸位帮忙看看。
<另外,我用Delphi也几年了,应该不会犯太简单的错误>
下面是源码
function ReadValue (Path , ValueName : string ) : string
export;
var
Reg : Tregistry;
begin
if Length (Path) =0 then
begin
Result := '';
exit;
end;
try
reg := Tregistry.create;
Reg.RootKey := HKey_Local_machine;
if (Reg.OpenKey (Path,False)) and (ValueName<>'') then
Result := Reg.ReadString(ValueName);
finally
Reg.Free;
end;
end;