function TMain.WriteAppNameToReg: Boolean;
var
reg,Regedit :TRegistry;
sPath,sAppName:String;
begin
Result := True;
reg := TRegistry.Create;
try
Regedit := TRegistry.Create;
Regedit.RootKey := HKEY_LOCAL_MACHINE;
Regedit.OpenKey('SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION', true);
Regedit.WriteInteger(ExtractFileName(Application.ExeName), 100000);
Regedit.CloseKey;
FreeAndNil(Regedit);
except
end;
try
reg.RootKey := HKEY_LOCAL_MACHINE;
sPath := 'SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION';
if isWin64 then
sPath := 'SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION';
if reg.OpenKey(sPath,True) then
begin
sAppName := ExtractFileName(Application.ExeName);
if not reg.ValueExists(sAppName) then
reg.WriteInteger(sAppName,0);
end;
reg.CloseKey;
finally
FreeAndNil(reg);
end;
end;
写程序名到注册表
最新推荐文章于 2022-11-08 14:10:06 发布