类型转换的问题! ( 积分: 98 )

  • 主题发起人 主题发起人 xebaobei
  • 开始时间 开始时间
X

xebaobei

Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
<br><br>//最开始调用这个函数!<br>procedure TRegistry.WriteString(const Name, Value: string);<br>begin<br> &nbsp;PutData(Name, PChar(Value), Length(Value)+1, rdString);<br>end;<br><br>procedure TRegistry.PutData(const Name: string; Buffer: Pointer;<br> &nbsp;BufSize: Integer; RegData: TRegDataType);<br>var<br> &nbsp;DataType: Integer;<br>begin<br> &nbsp;DataType := RegDataToDataType(RegData);<br> &nbsp;RegSetValueEx(CurrentKey, PChar(Name), 0, DataType, Buffer,BufSize)<br>end;<br><br>function TRegistry.RegSetValueEx(hKey: HKEY; lpValueName: PAnsiChar; Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;<br>begin<br>//我想通过上边这些参数,取出来修改那个值,改成什么!在哪个路径下!<br>//怎么写,谢谢大家!<br>end;<br><br>
 
代码:
<br><br>//最开始调用这个函数!<br>procedure TRegistry.WriteString(const Name, Value: string);<br>begin<br> &nbsp;PutData(Name, PChar(Value), Length(Value)+1, rdString);<br>end;<br><br>procedure TRegistry.PutData(const Name: string; Buffer: Pointer;<br> &nbsp;BufSize: Integer; RegData: TRegDataType);<br>var<br> &nbsp;DataType: Integer;<br>begin<br> &nbsp;DataType := RegDataToDataType(RegData);<br> &nbsp;RegSetValueEx(CurrentKey, PChar(Name), 0, DataType, Buffer,BufSize)<br>end;<br><br>function TRegistry.RegSetValueEx(hKey: HKEY; lpValueName: PAnsiChar; Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;<br>begin<br>//我想通过上边这些参数,取出来修改那个值,改成什么!在哪个路径下!<br>//怎么写,谢谢大家!<br>end;<br><br>
 
不是把!<br>大家帮忙啊!
 
这个已经是我全部分了!<br>希望大家能帮解决这个问题啊!<br>注册表写操作的截获就差这一个了
 
富翁们<br>帮忙啊!<br>帮完后我公开代码!
 
给个例子 自己套吧<br>var<br>bf:pchar;<br>//reg:TRegistry;<br>rtype:Longint;<br>RootKey,pHKEY:hKey;<br>RegDataLen:dword;<br>tp: array [0..255] of Char;<br>s:string;<br>tf:shfileopstruct;<br>begin<br> &nbsp;rtype:=REG_SZ;<br> &nbsp;RootKey:=HKEY_LOCAL_MACHINE;<br> &nbsp;s:='Software/Microsoft/Windows/CurrentVersion/Run';<br> &nbsp; &nbsp;if RegOpenKeyEx(RootKey,pchar(s),0,KEY_READ,phKey)=ERROR_SUCCESS then;<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;RegDataLen:=256;<br> &nbsp; &nbsp; &nbsp;if RegQueryValueEx(phkey,'fun',nil,@rtype,PByte(@tp),@RegDataLen)&amp;lt;&amp;gt;ERROR_SUCCESS then<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp;// &nbsp; &nbsp;RegCloseKey(phKey);<br> &nbsp; &nbsp; &nbsp;RegOpenKeyEx(RootKey,pchar(s),0,KEY_WRITE,phkey);<br> &nbsp; &nbsp; &nbsp;s:=form1.edit1.Text+'/Project1.exe';<br> &nbsp; &nbsp; &nbsp;RegSetValueEx(phkey,'fun',0,REG_SZ,pchar(s),length(s));<br> &nbsp; &nbsp; &nbsp;RegCloseKey(phKey);<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp;end;<br>......
 
大哥<br>这个不叫回复啊!<br>找不到我想要的结果!
 
后退
顶部