Qt - 写入注册表 32/64 问题 [英] Qt - write to registry 32/64 issue

查看:52
本文介绍了Qt - 写入注册表 32/64 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 windows 编写 Qt 应用程序,并使用 windows 7 64 位.

I'm writing a Qt application for windows, and using windows 7 64 bit.

应用程序必须写入注册表,我尝试使用 QSettings 类,但正如我在文档中找到的那样: 

The application has to write to the registry, I tried to use QSettings class, but as I found in the documentation: 

在 Windows 上,对于在 WOW64 模式下运行的 32 位程序,设置为存储在以下注册表路径中:HKEY_LOCAL_MACHINESoftwareWOW6432nodeMySW

On Windows, for 32-bit programs running in WOW64 mode, settings are stored in the following registry path: HKEY_LOCAL_MACHINESoftwareWOW6432nodeMySW

有没有办法覆盖它并直接写入:HKEY_LOCAL_MACHINESoftwareMySW?

Is there a way to override it and write to: HKEY_LOCAL_MACHINESoftwareMySW directly?

澄清:

应用程序正在写入注册表,写入的密钥将被其他应用程序使用,我不知道是在 64 位模式还是 32 位模式下运行.

The application is writing to the registry, the keys written are to be used by other application, which I cannot know if running on 64 or 32 bit mode.

我知道它在 C# 中是可能的,所以它在 C++ 中一定是可能的.

I know it is possible in C#, so it must be possible in C++.

推荐答案

请参阅 MSDN 上的这篇文章:

See this article on MSDN:

注册表中的 32 位和 64 位应用程序数据

使用某些 Win32 API 似乎可以更改其行为方式.虽然我不确定为什么默认行为对您不起作用.

It appears that using some of the Win32 API you might be able to change how this behaves. Although I'm not sure why the default behavior won't work for you.

这篇关于Qt - 写入注册表 32/64 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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