getvisionex的使用方法(50分)

  • 主题发起人 主题发起人 jameschin
  • 开始时间 开始时间
J

jameschin

Unregistered / Unconfirmed
GUEST, unregistred user!
请给我一个例子,关于getvisionex的使用.
 
nobody use?<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; MyVerInfo: TOSVersionInfo; &nbsp; &nbsp;// holds version information<br>begin<br>&nbsp; {set the size member of the TOSVersionInfo structure}<br>&nbsp; MyVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);<br><br>&nbsp; {retrieve the operating system version information}<br>&nbsp; GetVersionEx(MyVerInfo);<br><br>&nbsp; {display the operating system version information}<br>&nbsp; Panel2.Caption := IntToStr(MyVerInfo.dwMajorVersion);<br><br>&nbsp; Panel3.Caption := IntToStr(MyVerInfo.dwMinorVersion);<br>&nbsp; Panel4.Caption := IntToStr(MyVerInfo.dwBuildNumber);<br>&nbsp; case MyVerInfo.dwPlatformId of<br>&nbsp; &nbsp; VER_PLATFORM_WIN32s: &nbsp; &nbsp; &nbsp; &nbsp;Panel5.Caption := 'Win 32s under Windows 3.1';<br>&nbsp; &nbsp; VER_PLATFORM_WIN32_WINDOWS: Panel5.Caption := 'Windows 95';<br>&nbsp; &nbsp; VER_PLATFORM_WIN32_NT: &nbsp; &nbsp; &nbsp;Panel5.Caption := 'Windows NT';<br>&nbsp; end;<br>end;<br><br>
 
C++的:<br>&nbsp; &nbsp; OSVERSIONINFO ver;<br>&nbsp; &nbsp; ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);<br>&nbsp; &nbsp; GetVersionEx(&amp;ver);<br>&nbsp; &nbsp; switch(ver.dwPlatformId)<br>&nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; case VER_PLATFORM_WIN32s:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(Handle,("Your PlatForm is : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /nWindows3.x " + IntToStr(ver.dwMajorVersion) + "." + IntToStr(ver.dwMinorVersion) + "/nBuild : " + IntToStr(ver.dwBuildNumber) + "/n This Software Can't Run in Win3.x !").c_str(),"自动登录",MB_OK+MB_ICONINFORMATION);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br>&nbsp; &nbsp; &nbsp; &nbsp; case VER_PLATFORM_WIN32_WINDOWS:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strRegPath = "//SOFTWARE//Microsoft//Windows//CurrentVersion//Winlogon";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(Handle,("Your PlatForm is : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /nWindows9x " + IntToStr(ver.dwMajorVersion) + "." + IntToStr(ver.dwMinorVersion) + "/nBuild : " + IntToStr(ver.dwBuildNumber)).c_str(),"自动登录",MB_OK+MB_ICONINFORMATION);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; &nbsp; &nbsp; case VER_PLATFORM_WIN32_NT:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strRegPath = "//SOFTWARE//Microsoft//Windows NT//CurrentVersion//Winlogon";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(Handle,("Your PlatForm is : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /nWindowsNT " + IntToStr(ver.dwMajorVersion) + "." + IntToStr(ver.dwMinorVersion) + "/nBuild : " + IntToStr(ver.dwBuildNumber)).c_str(),"自动登录",MB_OK+MB_ICONINFORMATION);<br>&nbsp; &nbsp; }
 
如何得到副版本号
 
ver.dwMinorVersion就是副版本号<br>
 
多人接受答案了。
 
后退
顶部