📄 nwconnectionsettings.h
字号:
//
// 8-may-2000 GBO
// gert.boddaert@advalvas.be
// =================================================================
// DISCLAIMER
// =================================================================
/*
This software is provided "as is" and any express or implied
warranties, including, but not limited to, the implied warranties of
merchantibility and fitness for a particular purpose are disclaimed.
In no event shall the author be liable for any
direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute
goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability,
whether in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this software,
even if advised of the possibility of such damage.
*/
// NWConnectionSettings.h: interface for the NWConnectionSettings class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DHCPSETTINGS_H__E51D44E5_B789_41A9_B37A_D58581BB195D__INCLUDED_)
#define AFX_DHCPSETTINGS_H__E51D44E5_B789_41A9_B37A_D58581BB195D__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Using Len Holgates Registry API Wrapper
// See ( http://www.codeproject.com/system/cregistrykey.asp )
// I also think there is a small 'typo' in his code:
// see my comment on the article "Typo in function CRegistryKey::QueryValue?"
#include "RegistryKey.hpp"
using namespace JetByteTools;
class NWConnectionSettings
{
public:
NWConnectionSettings();
virtual ~NWConnectionSettings();
// HIGH LEVEL ACCESS
// =================
// connect to the system and retrieve all the necessary registry settings
// if parameter is NULL, we take the settings of the local system
bool Connect(const char* strComputerName = NULL);
// release connection an resources
void Close();
// name of connected computer before changes
char* GetConnectedComputerName();
// LOWER LEVEL ACCESS
// ==================
// dhcp should be 1 when using static IP
// dhcp should be 2 when dhcp must start AUTOMATICALLY on bootup
DWORD GetDHCPServiceStartValue();
bool SetDHCPServiceStartValue(DWORD dhcp);
// Network card name, only 1 Network card is currently supported
char* GetName_NC1();
// Enable DHCP values are
// 0 = boot
// 1 = system (when using DHCP service)
// 2 = automatic
// 3 = manual
// 4 = disabled (when using statis IP)
DWORD GetEnableDHCP_NC1();
bool SetEnableDHCP_NC1(DWORD dhcpvalue);
// TCPIP Address is a string in the form W.X.Y.Z
char* GetTcpIpAddress_NC1();
bool SetTcpIpAddress_NC1(const char* tcpipaddress);
// TCPIP SubnetMask is a string in the form W.X.Y.Z
char* GetTcpIpSubnetMask_NC1();
bool SetTcpIpSubnetMask_NC1(const char* subnetmask);
// TCPIP Default Gateway is a string in the form W.X.Y.Z
char* GetDefaultGateway_NC1();
bool SetDefaultGateway_NC1(const char* defaultgateway);
// Network Hostname
char* GetHostName();
bool SetHostName(const char* hostname);
// Computername (can be different from Hostname)
char* GetComputerName();
bool SetComputerName(const char* computername);
protected:
NWConnectionSettings(const NWConnectionSettings& DHCPSettingsObject);
NWConnectionSettings& operator=(const NWConnectionSettings &DHCPSettingsObject);
void DeleteObjects();
private:
char* p_myServiceName;
char* p_myIPAddress;
char* p_mySubNetMask;
char* p_myDefaultGateway;
char* p_myHostName;
char* p_myRemoteComputerName; // new name is stored here
DWORD my_dwDhcpServiceStart;
DWORD my_dwTCPIP_EnableDhcp;
char* p_myComputerName; // interface name
CRegistryKey myDhcpServiceKey;
CRegistryKey myNetworkCardKey1;
CRegistryKey myTcpIpNC1Key;
CRegistryKey myTcpIpServiceKey;
CRegistryKey myComputerKey;
};
#endif // !defined(AFX_DHCPSETTINGS_H__E51D44E5_B789_41A9_B37A_D58581BB195D__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -