Click here to Skip to main content
15,886,110 members
Articles / Desktop Programming / MFC

The Win32 Foundation Classes (WFC) - Version 45

Rate me:
Please Sign up or sign in to vote.
4.93/5 (40 votes)
16 May 2000 468.1K   12.7K   280  
The Win32 Foundation Classes (WFC) are a library of C++ classes that extend Microsoft Foundation Classes (MFC) beyond mere GUI applications, and provide extensive support for system and NT specific applications
#if ! defined( NETWORK_CONNECTION_CLASS_HEADER )

/*
** Author: Samuel R. Blackburn
** Internet: wfc@pobox.com
**
** You can use it any way you like as long as you don't try to sell it.
**
** Any attempt to sell WFC in source code form must have the permission
** of the original author. You can produce commercial executables with
** WFC but you can't sell WFC.
**
** Copyright, 2000, Samuel R. Blackburn
**
** $Workfile: cnetconn.hpp $
** $Revision: 11 $
** $Modtime: 1/04/00 4:51a $
*/

#define NETWORK_CONNECTION_CLASS_HEADER

class CNetworkConnectionInformation
#if ! defined(  WFC_NO_SERIALIZATION )
: public CObject
#endif // WFC_NO_SERIALIZATION
{
#if ! defined(  WFC_NO_SERIALIZATION )
   DECLARE_SERIAL( CNetworkConnectionInformation )
#endif // WFC_NO_SERIALIZATION

   private:

      void m_Initialize( void );

   public:

      CNetworkConnectionInformation();

      /*
      ** Can't make Copy take a const pointer because Microsoft screwed up the 
      ** net API header files...
      */

      CNetworkConnectionInformation( const CONNECTION_INFO_1 *information_p );
      CNetworkConnectionInformation( const CNetworkConnectionInformation& source );
      virtual ~CNetworkConnectionInformation();

      DWORD   ID;
      DWORD   Type;
      DWORD   NumberOfUsers;
      DWORD   NumberOfOpens;
      DWORD   Time;
      CString UserName;
      CString NetName;

      /*
      ** Can't make Copy take a const pointer because Microsoft screwed up the 
      ** net API header files...
      */

      virtual void Copy( const CONNECTION_INFO_1 *source );
      virtual void Copy( const CNetworkConnectionInformation& source );
      virtual void Empty( void );

#if ! defined(  WFC_NO_SERIALIZATION )
      virtual void Serialize( CArchive& archive );
#endif // WFC_NO_SERIALIZATION

      virtual const CNetworkConnectionInformation& operator=( const CNetworkConnectionInformation& source );

#if defined( _DEBUG ) && ! defined( WFC_NO_DUMPING )
      virtual void Dump( CDumpContext& dump_context ) const;
#endif // _DEBUG
};

class CNetworkConnections : public CNetwork
{
#if ! defined(  WFC_NO_SERIALIZATION )
   DECLARE_SERIAL( CNetworkConnections )
#endif // WFC_NO_SERIALIZATION

   private:

      // Don't allow canonical behavior (i.e. don't allow this class
      // to be passed by value)

      CNetworkConnections( const CNetworkConnections& ) {};
      CNetworkConnections& operator=( const CNetworkConnections& ) { return( *this ); };

   private:

      void m_Initialize( void );

   protected:

      /*
      ** Connection information variables
      */

      CONNECTION_INFO_1 * m_1InformationBuffer;

      /*
      ** File Information enumeration variables
      */

      DWORD m_1Index;
      DWORD m_1ResumeHandle;
      DWORD m_1CurrentEntryNumber;
      DWORD m_1NumberOfEntriesRead;
      DWORD m_1TotalNumberOfEntries;

      BOOL m_GetChunk( void );

      WCHAR m_WideShareOrComputerName[ MAX_PATH ];

public:

      CNetworkConnections();
      CNetworkConnections( LPCTSTR machine_name );
      virtual ~CNetworkConnections();

      virtual void  Close( void );
      virtual BOOL  Enumerate( LPCTSTR share_or_computer_name );
      virtual BOOL  GetNext( CNetworkConnectionInformation& information );

#if ! defined(  WFC_NO_SERIALIZATION )
      virtual void  Serialize( CArchive& archive );
#endif // WFC_NO_SERIALIZATION

#if defined( _DEBUG ) && ! defined( WFC_NO_DUMPING )
      virtual void Dump( CDumpContext& dump_context ) const;
#endif // _DEBUG
};

#endif // NETWORK_CONNECTION_CLASS_HEADER

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
I'm just a simple little NT programmer. Most of the work I do is remote controlling equipment in real time. I started out using Windows 3.0. Then came 3.1 and then NT. I started using NT but unfortunately, Microsoft didn't. I started using MFC but unfortunately, Microsoft didn't (and still doesn't) put any real support for NT into MFC so I wrote a bunch of C++ classes to make my life easier. Like all class libraries, mine grew. Now I'm giving it away, I call it Win32 Foundation Classes.

Check out Sam's homepage at www.SamBlackburn.com/wfc/.

Comments and Discussions