从c#中删除在c ++代码中创建的注册表 [英] Delete registry created in c++ code from c#

查看:71
本文介绍了从c#中删除在c ++代码中创建的注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有c#父窗口和c ++子窗口。



我正在编写c ++子窗口位置并协调注册表,这样如果再次从c#启动c ++窗口,它将保留当前会话的相同位置



 WINDOWPLACEMENT wp; 
GetWindowPlacement(& wp);
AfxGetApp() - > WriteProfileBinary( MainFrame WP,(LPBYTE)& wp, sizeof (wp ));







但如果父窗口本身已关闭,我想删除该注册表,以便第一次c ++子窗口采用默认位置和坐标。





那么如何从c#中删除在c ++中创建的WINDOWPLACEMENT注册表代码

解决方案

从c#操作注册表非常简单。

使用C#从注册表中读取,写入和删除 [ ^ ]

https://msdn.microsoft.com/en-us/library/h3yfwzfx(v = vs.110).aspx [ ^ ]


解决方案:不要这样做

使用Windows注册表配置单元这样做是过度的。



注意:用于创建注册表项的语言对删除相同注册表项的方式没有影响,无论使用何种语言。



您只需要要设置变量来存储窗口位置,变量值只需在子窗口调用之间保持不变。


Hi,

I have c# parent window and a c++ child window.

I am writing c++ child window postion and coordinates to registry so that if again c++ window is launched from c#, it retains the same position for the current session

WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
AfxGetApp()->WriteProfileBinary("MainFrame", "WP", (LPBYTE)&wp, sizeof(wp));




But if parent window itself is closed i want to delete that registry so that for first time the c++ child window takes default position and coordinates.


So how do i delete WINDOWPLACEMENT registry created in c++ from the c# code

解决方案

It is quite simple to manipulate registry from c#.
Read, write and delete from registry with C#[^]
https://msdn.microsoft.com/en-us/library/h3yfwzfx(v=vs.110).aspx[^]


Solution: Don't do this
Using Windows Registry Hive for this is overkill.

Note: The language used to create a registry entry have no impact on the way to delete the same registry entry, whatever is the language used to do it.

You simply need to set variables to store the window position, the variables values simply have to persist between child window calls.


这篇关于从c#中删除在c ++代码中创建的注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆