Determine when running in a virtual machine

后端 未结 10 505
遇见更好的自我
遇见更好的自我 2020-12-12 11:39

Is there an official way for an application to determine if it is running in VMWare or Virtual PC (or whatever Microsoft is calling it now)? The code I have seen i

10条回答
  •  渐次进展
    2020-12-12 12:02

    There is a WMI way posted here: http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/27/484479.aspx

    I've double checked in an XP image running on Virtual PC, and the value they're testing for is still the same. I won't guarantee what other VMs return here, though...

    I've actually got a Delphi program I wrote a couple of years ago to get a list of and change the default printer using WMI, without requiring 3rd party components or anything like that. In case you're not used to working with WMI from Delphi, I can send you a copy so you have something to work off (it's not necessarily Unicode-compatible, though, but it shouldn't be too hard for me to upgrade it if need be).

提交回复
热议问题