从Delphi(Win32)设置环境变量 [英] Set environment variables from Delphi (Win32)

查看:131
本文介绍了从Delphi(Win32)设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的delphi应用程序中设置一个系统的环境变量。文档说要向HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment添加一个注册表项,然后广播WM_SETTINGCHANGE消息。任何人知道如何广播此消息?



PS。我试图在控制台应用程序中执行此操作。

解决方案

在Embarcadero开发人员网络中还有一个涵盖此问题的主题并提供用于发送消息的示例代码。作者使用 SendMessageTimeout 根据 WM_SETTINGCHANGE的MSDN文档中的建议



http://edn.embarcadero.com/article/28254


I'm trying to set a system wide environment variable from within my delphi application. The Documentation says to add a registry key to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and then broadcast a WM_SETTINGCHANGE message. Anyone know how to Broadcast this message?

PS. I'm trying to do this in a console application.

解决方案

There is also a topic in the Embarcadero Developer Network covering this issue and providing sample code for sending the message. The author uses SendMessageTimeout as recommended in the MSDN doc for WM_SETTINGCHANGE:

http://edn.embarcadero.com/article/28254

这篇关于从Delphi(Win32)设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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