WarDaemonLib.cpp
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:4k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase
- // Copyright 1996 by Jarle Aase. All rights reserved.
- // See the "War Software Series Licende Agreement" for details concerning
- // use and distribution.
- // ---
- // This source code, executables and programs containing source code or
- // binaries or proprietetary technology from the War Software Series are
- // NOT alloed used, viewed or tested by any governmental agencies in
- // any countries. This includes the government, departments, police,
- // military etc.
- // ---
- // This file is intended for use with Tab space = 2
- // Created and maintained in MSVC Developer Studio
- // ---
- // NAME : WarDaemonLib.cpp
- // PURPOSE : General Daemon dll
- // PROGRAM :
- // DATE : Sept. 19 1996
- // AUTHOR : Jarle Aase
- // ---
- // REVISION HISTORY
- //
- #include "stdafx.h"
- #include "WarDaemon.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #include <afxdllx.h>
- static AFX_EXTENSION_MODULE WarDaemonLibDLL = { NULL, NULL };
- extern "C" int APIENTRY
- DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
- {
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- TRACE0("WARDAEMONLIB.DLL Initializing!n");
- // Extension DLL one-time initialization
- AfxInitExtensionModule(WarDaemonLibDLL, hInstance);
- // Insert this DLL into the resource chain
- //new CDynLinkLibrary(WarDaemonLibDLL);
- }
- else if (dwReason == DLL_PROCESS_DETACH)
- {
- TRACE0("WARDAEMONLIB.DLL Terminating!n");
- }
- return 1; // ok
- }
- // Exported DLL initialization is run in context of running application
- extern "C" void WINAPI InitWarDaemonLibDLL()
- {
- // create a new CDynLinkLibrary for this app
- new CDynLinkLibrary(WarDaemonLibDLL);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CNotificationWnd implementation
- CWnd *CDaemonNotificationWnd::m_pWnd = NULL;
- CWinThread *CDaemonNotificationWnd::m_pThread = NULL;
- CDaemonNotificationWnd::CDaemonNotificationWnd()
- {
- m_pWnd = this;
- m_pThread = AfxGetThread();
- }
- CDaemonNotificationWnd::~CDaemonNotificationWnd()
- {
- m_pWnd = NULL;
- m_pThread = NULL;
- }
- LRESULT CDaemonNotificationWnd::OnDNS(WPARAM WParam, LPARAM LParam)
- {
- CDNSLookup::DNSlookupCallback(WParam, LParam);
- return TRUE;
- }
- LONG CDaemonNotificationWnd::OnTrayIconMessage(WPARAM WParam, LPARAM LParam)
- {
- if (CDaemonBase::m_pDaemonBase)
- CDaemonBase::m_pDaemonBase->OnTrayIconMessage(WParam, LParam);
- return FALSE;
- }
- void CDaemonNotificationWnd::OnStopandquit()
- {
- if (CDaemonBase::m_pDaemonBase)
- CDaemonBase:: m_pDaemonBase->Shutdown(TRUE, TRUE, FALSE);
- }
- void CDaemonNotificationWnd::OnGoOnline()
- {
- if (CDaemonBase::m_pDaemonBase)
- CDaemonBase:: m_pDaemonBase->GoOnline(TRUE);
- }
- void CDaemonNotificationWnd::OnGoOffline()
- {
- if (CDaemonBase::m_pDaemonBase)
- CDaemonBase:: m_pDaemonBase->GoOnline(FALSE);
- }
- void CDaemonNotificationWnd::OnRestart()
- {
- if (CDaemonBase::m_pDaemonBase)
- {
- extern DLL_WAR_DAEMON_ BOOL g_DoRestart;
- g_DoRestart = TRUE;
- CDaemonBase:: m_pDaemonBase->Shutdown(TRUE, TRUE, FALSE);
- }
- }
- void CDaemonNotificationWnd::OnStartManager()
- {
- if (CDaemonBase::m_pDaemonBase)
- CDaemonBase:: m_pDaemonBase->StartManager();
- }
- /////////////////////////////////////////////////////////////////////////////
- // Message table implementation
- BEGIN_MESSAGE_MAP(CDaemonNotificationWnd, CWnd)
- //{{AFX_MSG_MAP(CWnd)
- ON_MESSAGE(WMU_SNM,OnTrayIconMessage)
- ON_COMMAND(ID_MENU_STOPANDQUIT, OnStopandquit)
- ON_MESSAGE(WMU_TX_DNS, OnDNS)
- ON_COMMAND(ID_MENU_GOONLINE, OnGoOnline)
- ON_COMMAND(ID_MENU_GOOFFLINE, OnGoOffline)
- ON_COMMAND(ID_MENU_RESTART, OnRestart)
- ON_COMMAND(ID_MENU_OPENMANAGER, OnStartManager)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()