RegCreateKey的使用(100分)

  • 主题发起人 主题发起人 无知者无畏
  • 开始时间 开始时间

无知者无畏

Unregistered / Unconfirmed
GUEST, unregistred user!
下面程序:<br>&nbsp; function WriteR(theHKEY: LongWord; Item, Name, Value: PChar): Integer;<br>&nbsp; var<br>&nbsp; &nbsp; I: LongWord;<br>&nbsp; begin<br>&nbsp; &nbsp; RegCreateKey(theHKEY, Item, I);<br>&nbsp; &nbsp; if Value &lt;&gt; nil then<br>&nbsp; &nbsp; &nbsp; RegSetValueEx(I, Name, 0, REG_SZ, Value, StrLen(Value));<br>&nbsp; &nbsp; Result := I;<br>&nbsp; end;<br>在DELPHI 3中可以通过,但<br>其中,RegCreateKey(theHKEY, Item, I);一句在DELPHI 5中却编译不过去,提示如下错误:<br><br>[Error] A.pas(119): Types of actual and formal var parameters must be identical<br><br>请问如何解决?<br>
 
将theHKEY和I的变量类型改为HKEY即可。<br>function WriteR(theHKEY: HKEY; Item, Name, Value: PChar): Integer;<br>var<br>&nbsp; &nbsp; I: HKEY;<br>begin<br>&nbsp; &nbsp; RegCreateKey(theHKEY, Item, I);<br>&nbsp; &nbsp; if Value &lt;&gt; nil then<br>&nbsp; &nbsp; &nbsp; RegSetValueEx(I, Name, 0, REG_SZ, Value, StrLen(Value));<br>&nbsp; &nbsp; Result := I;<br>end;
 
接受答案了.
 
后退
顶部