Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1995 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. ipaddr.cpp: CWndIpAddress class control implementation
  7. FILE HISTORY:
  8. */
  9. #include "stdafx.h"
  10. #include "ipaddr.hpp"
  11. extern "C"
  12. {
  13. #include "ipadd.h"
  14. #include "ipaddr.h"
  15. }
  16. // Static class-level data
  17. // Super window proc address
  18. WNDPROC CWndIpAddress :: m_wproc_super = NULL ;
  19. // Window class initialization flag
  20. BOOL CWndIpAddress :: m_b_inited = FALSE ;
  21. WNDPROC * CWndIpAddress :: GetSuperWndProcAddr ()
  22. {
  23. return & m_wproc_super ;
  24. }
  25. BOOL CWndIpAddress :: CreateWindowClass ( HINSTANCE hInstance )
  26. {
  27. Trace0("CWndIpAddress::CreateWindowClass\n");
  28. if ( ! m_b_inited )
  29. {
  30. m_b_inited = ::IPAddrInit( hInstance ) ;
  31. }
  32. return m_b_inited ;
  33. }
  34. IMPLEMENT_DYNAMIC(CWndIpAddress, CWnd)
  35. CWndIpAddress :: CWndIpAddress ()
  36. {
  37. }
  38. CWndIpAddress :: ~ CWndIpAddress ()
  39. {
  40. DestroyWindow();
  41. }
  42. BOOL CWndIpAddress :: Create (
  43. LPCTSTR lpszText,
  44. DWORD dwStyle,
  45. const RECT & rect,
  46. CWnd * pParentWnd,
  47. UINT nID )
  48. {
  49. return CWnd::Create( TEXT("IPAddress"), lpszText, dwStyle, rect, pParentWnd, nID);
  50. }
  51. // Modification flag handling
  52. void CWndIpAddress :: SetModify ( BOOL bModified )
  53. {
  54. ::SendMessage( m_hWnd, IP_SETMODIFY, bModified, 0 );
  55. }
  56. BOOL CWndIpAddress :: GetModify () const
  57. {
  58. return ::SendMessage( m_hWnd, IP_GETMODIFY, 0, 0 ) > 0 ;
  59. }
  60. void CWndIpAddress :: SetFocusField( int iField )
  61. {
  62. ::SendMessage( m_hWnd, IP_SETFOCUS, iField, 0);
  63. }
  64. void CWndIpAddress::ClearAddress ( )
  65. {
  66. ::SendMessage( m_hWnd, IP_CLEARADDRESS, 0, 0);
  67. }
  68. BOOL CWndIpAddress :: SetAddress ( DWORD dwAddr )
  69. {
  70. return ::SendMessage( m_hWnd, IP_SETADDRESS, 0, dwAddr ) > 0 ;
  71. }
  72. BOOL CWndIpAddress :: GetAddress ( DWORD * pdwAddr ) const
  73. {
  74. return ::SendMessage( m_hWnd, IP_GETADDRESS, 0,(LPARAM) pdwAddr ) > 0 ;
  75. }
  76. void SetReadOnly (BOOL fReadonly = TRUE);
  77. void SetField(int dwField, BYTE bValue);
  78. void CWndIpAddress :: SetReadOnly ( BOOL fReadOnly )
  79. {
  80. ::SendMessage( m_hWnd, IP_SETREADONLY, (WPARAM)fReadOnly, (LPARAM)0 );
  81. }
  82. void CWndIpAddress :: SetField (int dwField, BOOL fSet, BYTE bValue)
  83. {
  84. ::SendMessage( m_hWnd, IP_SETFIELD, (WPARAM)dwField, fSet
  85. ? MAKELPARAM(0, MAKEWORD(0, bValue))
  86. : (LPARAM)-1
  87. );
  88. }
  89. BYTE CWndIpAddress :: GetMask () const
  90. {
  91. DWORD_PTR dw = ::SendMessage( m_hWnd, IP_GETMASK, 0, 0);
  92. return (BYTE)dw;
  93. }
  94. BOOL CWndIpAddress :: SetMask(DWORD dwAddress, BYTE bMask)
  95. {
  96. return ::SendMessage( m_hWnd, IP_SETMASK, (WPARAM)bMask, (LPARAM)dwAddress) > 0;
  97. }
  98. BOOL CWndIpAddress :: IsBlank()
  99. {
  100. return ::SendMessage( m_hWnd, IP_ISBLANK, 0, 0) > 0;
  101. }