如何得到当前系统的windows和IE的版本? (50分)

  • 主题发起人 fantasy4u
  • 开始时间
F

fantasy4u

Unregistered / Unconfirmed
GUEST, unregistred user!
如何得到当前系统的windows和IE的版本?<br>
 
是哪个API函数我不记得了,建议你发到API版
 
哈,我来拿分了。<br>windows版本:var ver:integer;<br>&nbsp; &nbsp; major:integer;<br>&nbsp; &nbsp; minor:integer;<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; ver:=getversion;<br>&nbsp; &nbsp; &nbsp; major:=ver and 255;<br>&nbsp; &nbsp; &nbsp; minor:=(ver and 255*256)div 256;<br>&nbsp; &nbsp; &nbsp; ShowMessage('系統版本號是:'+IntToStr(ver));<br>&nbsp; &nbsp; &nbsp; ShowMessage('系統主版本號是:'+IntToStr(major));<br>&nbsp; &nbsp; &nbsp; ShowMessage('系統次版本號是:'+IntToStr(minor));<br>&nbsp; &nbsp; end;<br><br>IE版本:<br>&nbsp; Registry; <br><br>function GetIEVersion(Key: string): string; <br>var <br>&nbsp; Reg: TRegistry; <br>begin <br>&nbsp; Reg := TRegistry.Create; <br>&nbsp; try <br>&nbsp; &nbsp; Reg.RootKey := HKEY_LOCAL_MACHINE; <br>&nbsp; &nbsp; Reg.OpenKey('Software/Microsoft/Internet Explorer', False); <br>&nbsp; &nbsp; try <br>&nbsp; &nbsp; &nbsp; Result := Reg.ReadString(Key); <br>&nbsp; &nbsp; except <br>&nbsp; &nbsp; &nbsp; Result := ''; <br>&nbsp; &nbsp; end; <br>&nbsp; &nbsp; Reg.CloseKey; <br>&nbsp; finally <br>&nbsp; &nbsp; Reg.Free; <br>&nbsp; end; <br>end; <br><br><br>procedure TForm1.Button1Click(Sender: TObject); <br>begin <br>&nbsp; ShowMessage('IE-Version: ' + GetIEVersion('Version')[1] + '.' + GetIEVersion('Version')[3]); <br>&nbsp; ShowMessage('IE-Version: ' + GetIEVersion('Version')); <br>&nbsp; // &lt;major version&gt;.&lt;minor version&gt;.&lt;build number&gt;.&lt;sub-build number&gt; <br>end; <br><br><br>&nbsp;<br><br>
 
一般拿windows和IE版本就两种方法<br>第一种: 查注册表。具体在什么地方,你查一下注册表就知道了。<br>第二种:利用API,例如得到windows版本用GetVersion,得到IE版本用DllVersionInfo<br>&nbsp; &nbsp; &nbsp; &nbsp; GetVersion就不多说了,查查MSDN什么都在了,<br>&nbsp; &nbsp; &nbsp; &nbsp; DllVersionInfo在Shlwapi.dll。<br>
 
多人接受答案了。
 
顶部