Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Access Win32 const DRIVE_FIXED - How to?
|
Posted: Mar 17, 2003 12:15 AM
|
|
Oops, sorry I forgot to mention the crucial fact that you need to add a reference to the System.Management assembly to your project. (If you haven't done this before, you right click on the References in the Solution Explorer, and select it from the .Net list of references. If you are doing it from the command line, add WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Management.dll). This should resolve the problem of not finding the System.Management namespaces and the classes there.
As far as the cr/lf issue, I say we are now in the 21st century and cr/lf is completely meaningless on a windows form. I think it is especially stupid that it is required in .Net windows forms, when it isn't in plain old windows C/C++ apps.
As far as constant names, if MS doesn't "officially" define them somewhere in the .Net libraries, I don't know of any other choice than to get them from the old windows header files. It boils down to applying a meaningful name to a numeric value used in the API. These language-independent interfaces like WMI kind of fly in the face of old "use my header files for the meaningful names of these constants" schemes. I've had similar problems working with other COM controls, where the writer assumed that the clients are C++ programs that use the same headers. The same problems arise in JScript files, which are rife with redefinitions of constants, especially when they use a lot of WMI, but even with simple stuff like showing message boxes and creating files. VB always had this problem too.
|
|