Click here to Skip to main content
15,879,239 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 499.9K   8.6K   107  
Utility to extract system information
// NetworkInformation.h : Declaration of the CNetworkInformation

#ifndef __NETWORKINFORMATION_H_
#define __NETWORKINFORMATION_H_

#include "resource.h"       // main symbols
#include "SocketUtil.h"

/////////////////////////////////////////////////////////////////////////////
// CNetworkInformation
class ATL_NO_VTABLE CNetworkInformation : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CNetworkInformation, &CLSID_NetworkInformation>,
	public ISupportErrorInfo,
	public IDispatchImpl<INetworkInformation, &IID_INetworkInformation, &LIBID_SYSTEMNETWORKLib>
{
public:
	CNetworkInformation()
		: m_pSocketUtil(NULL)
		, m_bInfoGenerated(false)
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_NETWORKINFORMATION)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CNetworkInformation)
	COM_INTERFACE_ENTRY(INetworkInformation)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()

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

// INetworkInformation
	HRESULT FinalConstruct();
	void FinalRelease() ;

public:
private:
	HRESULT GetInformation(void);
public:
	STDMETHODIMP GetNetworkInfo(void);
protected:
	CSocketUtil* m_pSocketUtil;
	bool m_bInfoGenerated;
	CComBSTR m_bstrIPAddress;
};

#endif //__NETWORKINFORMATION_H_

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