--- In [email protected], Vahan Yoghoudjian <[EMAIL PROTECTED]> wrote: > Hi Katja.... > > Just one question > > Why using the registry for this is not reliable? can you give some > examples please > > Thanks > Vahan
There are several reasons why the Registry might be unreliable. First of all, the security mechanism might have blocked access for the current user to some parts of the Registry. WMI is a connection to a system service that runs with a system account and thus always has access to this information. Another reason is that in future versions, the names and locations of these registry settings might change. Unless you read on an OFFICIAL microsoft site that it's safe to read these values from the registry, you will have to assume they are not. And of course it is possible that the Registry doesn't even contain the information that you are looking for. In my case, for example, I see \Device\Serial0, \Device\Serial1 and Winachsf0. The last one happens to be a modemcard in my system. The flaw in your code while reading the Registry is simple. By using GetValueNames you read just the names of all these keys. You don't need the names, but the values. So you must get this list of names and enumerate them, calling ReadString() for every value in this list. Then you get the values. However, I just think the use of WMI offers a lot more power in this case, since you can get more information about these devices than just the Device ID's of these ports. And basically, WMI just uses some SQL-like queries to get the data you want. You need to experiment with it a bit, but once you realise it's powers, it can be a valuable tool to use. WMI is available in all recent versions of Windows. WMI is installed with Windows Me, Windows 2000, Windows XP and Windows Server 2003. For Windows 98 and Windows NT 4.0, WMI is available as an Internet download from http://www.microsoft.com/downloads. Search for the download "Windows Management Instrumentation (WMI) CORE 1.5 (Windows 95/98/NT 4.0)." Also take a look at http://www.microsoft.com/technet/scriptcenter/resources/wmifaq.mspx where I stole that quote above. :) In my personal experience, WMI is just a great way to collect system information, simply because you query the system and the WMI service has the required access to the information that you want to know. And it's pretty fast too. With kind regards, X Katja Bergman. ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hnuei9m/M=362335.6886445.7839731.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123509732/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font> --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

