• PUDN用户
    了解作者
  • Visual C++
    开发工具
  • 4MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 20
    下载次数
  • 2013-11-05 13:21
    上传日期
用visual c++编写的防火墙的设计与实现
firewall.rar
  • 第十一章 防火墙的设计与实现
  • 源代码
  • Debug
  • SystemTray.obj
    82.2KB
  • AddRuleDlg.sbr
    0B
  • vc60.pdb
    388KB
  • MainFrm.sbr
    0B
  • fire.pdb
    689KB
  • fire.sbr
    0B
  • PortScanDlg.sbr
    0B
  • fire.ilk
    680KB
  • vc60.idb
    265KB
  • AddRuleDlg.obj
    35.7KB
  • TDriver.obj
    22.5KB
  • fire.bsc
    5.3MB
  • fire.obj
    27.4KB
  • fireDoc.sbr
    0B
  • TDriver.sbr
    0B
  • fire.exe
    212.1KB
  • TheSocket.sbr
    0B
  • SystemTray.sbr
    0B
  • StarWarsCtrl.sbr
    0B
  • sockUtil.sbr
    0B
  • MainFrm.obj
    30.3KB
  • sockUtil.obj
    3.5KB
  • StdAfx.obj
    103.3KB
  • fire.res
    29.8KB
  • StarWarsCtrl.obj
    40.9KB
  • PortScanDlg.obj
    43.5KB
  • fire.pch
    6.7MB
  • fireView.obj
    60KB
  • StdAfx.sbr
    1.3MB
  • TheSocket.obj
    6.4KB
  • fireView.sbr
    0B
  • fireDoc.obj
    14.5KB
  • res
  • led_red.ico
    2.1KB
  • fireDoc.ico
    1.1KB
  • fire.ico
    1.1KB
  • led_off.ico
    2.1KB
  • bitmap1.bmp
    1.2KB
  • led_gree.ico
    2.1KB
  • toolbar1.bmp
    11.9KB
  • Toolbar.bmp
    1.4KB
  • fire.rc2
    396B
  • fire.rc
    15.6KB
  • StdAfx.cpp
    206B
  • saved.rul
    262B
  • resource.h
    3KB
  • TDriver.h
    2.7KB
  • fire.plg
    1.9KB
  • fire.clw
    8.2KB
  • SystemTray.h
    5.5KB
  • stdafx.h
    1.1KB
  • AddRuleDlg.h
    2.1KB
  • fireDoc.h
    1.4KB
  • StarWarsCtrl.cpp
    12.6KB
  • StarWarsCtrl.h
    1.7KB
  • fire.dsp
    6KB
  • fire.aps
    53.9KB
  • MainFrm.h
    2KB
  • TheSocket.h
    1.2KB
  • sockUtil.cpp
    1.1KB
  • fire.dsw
    531B
  • fireView.h
    3.8KB
  • resource.hm
    159B
  • MainFrm.cpp
    7.3KB
  • TheSocket.cpp
    813B
  • AddRuleDlg.cpp
    8.6KB
  • DrvFltIp.sys
    3.9KB
  • fire.ncb
    249KB
  • DrvFltIp.h
    2.9KB
  • fireDoc.cpp
    1.7KB
  • fire.cpp
    4.5KB
  • fire.h
    1.3KB
  • TDriver.cpp
    14.1KB
  • PortScanDlg.cpp
    9KB
  • fireView.cpp
    14.7KB
  • SOCKUTIL.H
    671B
  • fire.opt
    75KB
  • PortScanDlg.h
    2.8KB
  • SystemTray.cpp
    29KB
内容介绍
///////////////////////////////////////////////////////////////////////////// // SystemTray.cpp : implementation file // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "SystemTray.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #ifndef _WIN32_WCE // Use C++ exception handling instead of structured. #undef TRY #undef CATCH #undef END_CATCH #define TRY try #define CATCH(ex_class, ex_object) catch(ex_class* ex_object) #define END_CATCH #endif // _WIN32_WCE #ifndef _countof #define _countof(x) ( sizeof(x) / sizeof(x[0]) ) #endif IMPLEMENT_DYNAMIC(CSystemTray, CWnd) const UINT CSystemTray::m_nTimerID = 4567; UINT CSystemTray::m_nMaxTooltipLength = 64; // This may change... const UINT CSystemTray::m_nTaskbarCreatedMsg = ::RegisterWindowMessage(_T("TaskbarCreated")); CWnd CSystemTray::m_wndInvisible; ///////////////////////////////////////////////////////////////////////////// // CSystemTray construction/creation/destruction CSystemTray::CSystemTray() { Initialise(); } CSystemTray::CSystemTray(CWnd* pParent, // The window that will recieve tray notifications UINT uCallbackMessage, // the callback message to send to parent LPCTSTR szToolTip, // tray icon tooltip HICON icon, // Handle to icon UINT uID, // Identifier of tray icon BOOL bHidden /*=FALSE*/, // Hidden on creation? LPCTSTR szBalloonTip /*=NULL*/, // Ballon tip (w2k only) LPCTSTR szBalloonTitle /*=NULL*/, // Balloon tip title (w2k) DWORD dwBalloonIcon /*=NIIF_NONE*/,// Ballon tip icon (w2k) UINT uBalloonTimeout /*=10*/) // Balloon timeout (w2k) { Initialise(); Create(pParent, uCallbackMessage, szToolTip, icon, uID, bHidden, szBalloonTip, szBalloonTitle, dwBalloonIcon, uBalloonTimeout); } void CSystemTray::Initialise() { memset(&m_tnd, 0, sizeof(m_tnd)); m_bEnabled = FALSE; m_bHidden = TRUE; m_bRemoved = TRUE; m_DefaultMenuItemID = 0; m_DefaultMenuItemByPos = TRUE; m_bShowIconPending = FALSE; m_uIDTimer = 0; m_hSavedIcon = NULL; m_pTargetWnd = NULL; m_uCreationFlags = 0; #ifdef SYSTEMTRAY_USEW2K OSVERSIONINFO os = { sizeof(os) }; GetVersionEx(&os); m_bWin2K = ( VER_PLATFORM_WIN32_NT == os.dwPlatformId && os.dwMajorVersion >= 5 ); #else m_bWin2K = FALSE; #endif } ///////////////////////////////////////////////////////////////////////////// // szBalloonTip: Text for a balloon tooltip that is shown when the icon // is first added to the tray. Pass "" if you don't want // a balloon. // szBalloonTitle: Title text for the balloon tooltip. This text is shown // in bold above the szBalloonTip text. Pass "" if you // don't want a title. // dwBalloonIcon: Specifies which icon will appear in the balloon. Legal // values are: // NIIF_NONE: No icon // NIIF_INFO: Information // NIIF_WARNING: Exclamation // NIIF_ERROR: Critical error (red circle with X) // uBalloonTimeout: Number of seconds for the balloon to remain visible. // Must be between 10 and 30 inclusive. BOOL CSystemTray::Create(CWnd* pParent, UINT uCallbackMessage, LPCTSTR szToolTip, HICON icon, UINT uID, BOOL bHidden /*=FALSE*/, LPCTSTR szBalloonTip /*=NULL*/, LPCTSTR szBalloonTitle /*=NULL*/, DWORD dwBalloonIcon /*=NIIF_NONE*/, UINT uBalloonTimeout /*=10*/) { #ifdef _WIN32_WCE m_bEnabled = TRUE; #else // this is only for Windows 95 (or higher) m_bEnabled = (GetVersion() & 0xff) >= 4; if (!m_bEnabled) { ASSERT(FALSE); return FALSE; } #endif m_nMaxTooltipLength = _countof(m_tnd.szTip); // Make sure we avoid conflict with other messages ASSERT(uCallbackMessage >= WM_APP); // Tray only supports tooltip text up to m_nMaxTooltipLength) characters ASSERT(AfxIsValidString(szToolTip)); ASSERT(_tcslen(szToolTip) <= m_nMaxTooltipLength); // Create an invisible window CWnd::CreateEx(0, AfxRegisterWndClass(0), _T(""), WS_POPUP, 0,0,0,0, NULL, 0); // load up the NOTIFYICONDATA structure m_tnd.cbSize = sizeof(NOTIFYICONDATA); m_tnd.hWnd = pParent->GetSafeHwnd()? pParent->GetSafeHwnd() : m_hWnd; m_tnd.uID = uID; m_tnd.hIcon = icon; m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; m_tnd.uCallbackMessage = uCallbackMessage; _tcsncpy(m_tnd.szTip, szToolTip, m_nMaxTooltipLength-1); #ifdef SYSTEMTRAY_USEW2K if (m_bWin2K && szBalloonTip) { // The balloon tooltip text can be up to 255 chars long. ASSERT(AfxIsValidString(szBalloonTip)); ASSERT(lstrlen(szBalloonTip) < 256); // The balloon title text can be up to 63 chars long. if (szBalloonTitle) { ASSERT(AfxIsValidString(szBalloonTitle)); ASSERT(lstrlen(szBalloonTitle) < 64); } // dwBalloonIcon must be valid. ASSERT(NIIF_NONE == dwBalloonIcon || NIIF_INFO == dwBalloonIcon || NIIF_WARNING == dwBalloonIcon || NIIF_ERROR == dwBalloonIcon); // The timeout must be between 10 and 30 seconds. ASSERT(uBalloonTimeout >= 10 && uBalloonTimeout <= 30); m_tnd.uFlags |= NIF_INFO; _tcsncpy(m_tnd.szInfo, szBalloonTip, 255); if (szBalloonTitle) _tcsncpy(m_tnd.szInfoTitle, szBalloonTitle, 63); else m_tnd.szInfoTitle[0] = _T('\0'); m_tnd.uTimeout = uBalloonTimeout * 1000; // convert time to ms m_tnd.dwInfoFlags = dwBalloonIcon; } #endif m_bHidden = bHidden; #ifdef SYSTEMTRAY_USEW2K if (m_bWin2K && m_bHidden) { m_tnd.uFlags = NIF_STATE; m_tnd.dwState = NIS_HIDDEN; m_tnd.dwStateMask = NIS_HIDDEN; } #endif m_uCreationFlags = m_tnd.uFlags; // Store in case we need to recreate in OnTaskBarCreate BOOL bResult = TRUE; if (!m_bHidden || m_bWin2K) { bResult = Shell_NotifyIcon(NIM_ADD, &m_tnd); m_bShowIconPending = m_bHidden = m_bRemoved = !bResult; } #ifdef SYSTEMTRAY_USEW2K if (m_bWin2K && szBalloonTip) { // Zero out the balloon text string so that later operations won't redisplay // the balloon. m_tnd.szInfo[0] = _T('\0'); } #endif return bResult; } CSystemTray::~CSystemTray() { RemoveIcon(); m_IconList.RemoveAll(); DestroyWindow(); } ///////////////////////////////////////////////////////////////////////////// // CSystemTray icon manipulation ////////////////////////////////////////////////////////////////////////// // // Function: SetFocus() // // Description: // Sets the focus to the tray icon. Microsoft's Win 2K UI guidelines // say you should do this after the user dismisses the icon's context // menu. // // Input: // Nothing. // // Returns: // Nothing. // ////////////////////////////////////////////////////////////////////////// // Added by Michael Dunn, November, 1999 ////////////////////////////////////////////////////////////////////////// void CSystemTray::SetFocus() { #ifdef SYSTEMTRAY_USEW2K Shell_NotifyIcon ( NIM_SETFOCUS, &m_tnd ); #endif } BOOL CSystemTray::MoveToRigh
评论
    相关推荐
    • Firewall.rar
      课程实训写的源码,网络防火墙c++代码,能实现基本功能,适合初学者学习。
    • firewall.rar
      简单防火墙实现的源码,使用vc编写,可定制规则
    • FireWall.zip
      安卓通讯防火墙,用于实现拦截骚妖来电和垃圾短信,主要通过黑白名单实现
    • FIREWALL.rar
      c++实现防火墙技术,我们可以对端口进行扫描,可以对电脑实现安全防护
    • Firewall.rar
      采用Visual C++编写,实现了系统防火墙的部分功能,很值得下载和学习!-
    • Outpost Firewall Pro 防火墙汉化补丁
      Agnitum Outpost Firewall 是一款短小精悍的网络防火墙软件,它的功能是同类PC软件中最强的,甚至包括了广告和图片过滤、内容过滤、DNS缓存等功能。它能够预防来自Cookies、广告、电子邮件病毒、后门、窃密软件、...
    • firewall:防火墙食谱的开发存储库
      试图通过先从不太复杂的防火墙实现开始,然后与每个后续的提供者一起重构/审查资源定义,来保持资源简单/愚蠢。 要求 需要Chef 12.5.x + 。 我们目前正在针对Chef 13进行测试。如果您需要Chef 11支持,请尝试固定回...
    • firewall, 通用防火墙 cookbook 开发库.zip
      firewall, 通用防火墙 cookbook 开发库 防火墙 cookbook 提供一组用于管理防火墙和关联规则的原语。请注意- 这里 cookbook 中... 首先,通过先从较少的防火墙实现开始,然后重构/with资源定义来保持资源简单。要求需要
    • firewall, 通用防火墙 cookbook 开发库.zip
      firewall, 通用防火墙 cookbook 开发库 防火墙 cookbook 提供一组用于管理防火墙和关联规则的原语。请注意- 这里 cookbook 中... 首先,通过先从较少的防火墙实现开始,然后重构/with资源定义来保持资源简单。要求需要
    • sendmail.8.10.0.Beta10.tar.Z
      被广泛使用的发送邮件(SMTP)服务器