delphi设置环境变量
来源:互联网 发布:403 forbidden nginx 编辑:程序博客网 时间:2024/06/17 13:32
{*********************************************}
{ Set Global Environment Function }
{ Coder : Kingron,2002.8.6 }
{ Bug Report : Kingron@163.net }
{ Test OK For Windows 2000 Advance Server }
{ Parameter: }
{ Name : The environment name }
{ Value: The environment Value }
{ Ex: SetGlobalEnvironment('MyVar','OK') }
{*********************************************}
function SetGlobalEnvironment(const Name,Value:string):boolean;
const
REG_LOCATION='System/CurrentControlSet/Control/Session Manager/Environment';
var
R:DWORD;
begin
with TRegistry.Create do
try
RootKey :=HKEY_LOCAL_MACHINE;
Result :=OpenKey(REG_LOCATION,True);
if Result then
begin
WriteString(Name,Value);
SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,integer(Pchar('Environment')));
// SendMessageTimeOut(HWND_BROADCAST,WM_SETTINGCHANGE,0,integer(Pchar('Environment')),SMTO_NORMAL,1000,R);
end;
finally
Free;
end;
end;
{ Set Global Environment Function }
{ Coder : Kingron,2002.8.6 }
{ Bug Report : Kingron@163.net }
{ Test OK For Windows 2000 Advance Server }
{ Parameter: }
{ Name : The environment name }
{ Value: The environment Value }
{ Ex: SetGlobalEnvironment('MyVar','OK') }
{*********************************************}
function SetGlobalEnvironment(const Name,Value:string):boolean;
const
REG_LOCATION='System/CurrentControlSet/Control/Session Manager/Environment';
var
R:DWORD;
begin
with TRegistry.Create do
try
RootKey :=HKEY_LOCAL_MACHINE;
Result :=OpenKey(REG_LOCATION,True);
if Result then
begin
WriteString(Name,Value);
SendMessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,integer(Pchar('Environment')));
// SendMessageTimeOut(HWND_BROADCAST,WM_SETTINGCHANGE,0,integer(Pchar('Environment')),SMTO_NORMAL,1000,R);
end;
finally
Free;
end;
end;
- delphi设置环境变量
- 系统环境变量的设置Delphi函数
- 系统环境变量的设置Delphi函数
- 设置环境变量
- 环境变量设置
- 环境变量设置
- 设置环境变量
- 环境变量设置
- 设置环境变量
- 设置环境变量
- 设置环境变量
- 设置环境变量
- 环境变量设置
- 环境变量设置
- 环境变量设置
- 设置环境变量
- 环境变量设置
- 设置环境变量
- 给大家一点学习C语言的忠告
- 黑莓之IMEI号获取
- 递归获取treeview选中父节点的所有子节点
- shanks
- c# Post 通过HttpWebRequest 网页通信
- delphi设置环境变量
- TortoiseSVN - Download下载 - 1.5.6
- delphi资源文件的使用
- Asp网页搜索引擎,绝对原创,本文章提供源代码
- HQL的使用-part2 hql的查询(2)
- SQL操作全集
- HQL的使用-part2 hql的查询(3)
- Java缓存技术介绍(JCS开源项目)-----索引磁盘备用缓存
- 500强公司面试的经典正确与错误回答对比!!! 看看你的弱点