views:

43

answers:

1

Please bare with me. I am learning how to make these DLLs properly. Hopefully my questions become more intelligent as I go.

I would like to make a Win32 DLL (unmanaged code) using Visual Studio 2008. After selecting New Project, in Project types -> Other Languages -> Visual C++ -> Win32 I selected Win32 Project as the project type. Then I gave it a name and specified the location, and clicked OK. In the Win32 Application Wizard, I have these settings selected:

  • Application type: DLL
  • Additional options: Export symbols

Should the ATL or MFC common header files be selected?

The purpose of this DLL is to scan the local system for attached USB devices and return information about them. I know ManagementObjectSearcher can be used to do this in C#, but I haven't yet figured out how/if this can be done in C++.

Thoughts are welcome. Thanks.

+1  A: 

You only need ATL for COM, generally (so might be marginally useful if you do use WMI for this task). WMI is what underpins System.Management in the .Net Framework.

MFC is a general-purpose class library built to wrap Win32 APIs, if there is WMI support (I don't think so - list is here) you might find it useful.

There are various USB classes here accessible by WMI. You should be able to enumerate the list that is present on your system and output what you need. Check out the C++ example here. It's ugly, C# would be a lot easier.

Steve Townsend