Click here to Skip to main content
15,895,746 members
Articles / Programming Languages / C++

System Information Utility

Rate me:
Please Sign up or sign in to vote.
4.95/5 (12 votes)
17 Apr 2001 502.5K   8.6K   107  
Utility to extract system information
// PnPDevice.h : Declaration of the CPnPDevice

#pragma once
#include "resource.h"       // main symbols
#include "PnPDeviceDrivers.h"



// CPnPDevice

class ATL_NO_VTABLE CPnPDevice : 
	public CComObjectRootEx<CComSingleThreadModel>,
//	public CComCoClass<CPnPDevice, &CLSID_PnPDevice>,
	public ISupportErrorInfo,
	public IDispatchImpl<IPnPDevice, &IID_IPnPDevice, &LIBID_SYSTEMPNPDEVICESLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	CPnPDevice()
	{
	}

//DECLARE_REGISTRY_RESOURCEID(IDR_PNPDEVICE)


BEGIN_COM_MAP(CPnPDevice)
	COM_INTERFACE_ENTRY(IPnPDevice)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		m_pDrivers = NULL;
		return S_OK;
	}
	
	void FinalRelease() 
	{
		if (NULL != m_pDrivers)
		{
			m_pDrivers->Release ();
		}
		m_pDrivers = NULL;
	}

public:

	STDMETHODIMP get_Description(BSTR* pVal);
	STDMETHODIMP get_HardwareID(BSTR* pVal);
	STDMETHODIMP get_ClassGUID(BSTR* pVal);
	STDMETHODIMP get_Driver(BSTR* pVal);
	STDMETHODIMP get_Manufacturer(BSTR* pVal);
	STDMETHODIMP get_FriendlyName(BSTR* pVal);
	STDMETHODIMP get_DeviceType(BSTR* pVal);
	STDMETHODIMP get_VendorID(BSTR* pVal);
	STDMETHODIMP get_ProductID(BSTR* pVal);
	STDMETHODIMP get_ProductRevision(BSTR* pVal);
	STDMETHODIMP get_SerialNumber(BSTR* pVal);

protected:
	CComBSTR m_bstrDescription;
	CComBSTR m_bstrHWId;
	CComBSTR m_bstrClassGUID;
	CComBSTR m_bstrDriver;
	CComBSTR m_bstrMfg;
	CComBSTR m_bstrFriendlyName;
	CComBSTR m_bstrDeviceType;
	CComBSTR m_bstrVendorID;
	CComBSTR m_bstrProductID;
	CComBSTR m_bstrProductRevision;
	CComBSTR m_bstrSerialNumber;
	IPnPDeviceDrivers *m_pDrivers;

	friend class CPnPDevicesInfo;
public:
	STDMETHODIMP get_DeviceDrivers(IPnPDeviceDrivers** pVal);
};

//OBJECT_ENTRY_AUTO(__uuidof(PnPDevice), CPnPDevice)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions