WarSoftwareLib.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 : WarSoftwareLib.cpp
- // PURPOSE : Defines the initialization routines for the DLL.
- // PROGRAM :
- // DATE : Sept. 19 1996
- // AUTHOR : Jarle Aase
- // ---
- // REVISION HISTORY
- #include "stdafx.h"
- #include "resource.h"
- #include "..IncludeWarSoftware.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #include <afxdllx.h>
- static AFX_EXTENSION_MODULE WarSoftwareLibDLL = { NULL, NULL };
- extern "C" int APIENTRY
- DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
- {
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- TRACE0("WARSOFTWARELIB.DLL Initializing!n");
- // Extension DLL one-time initialization
- AfxInitExtensionModule(WarSoftwareLibDLL, hInstance);
- }
- else if (dwReason == DLL_PROCESS_DETACH)
- {
- TRACE0("WARSOFTWARELIB.DLL Terminating!n");
- }
- return 1; // ok
- }
- // Exported DLL initialization is run in context of running application
- extern "C" void WINAPI InitWarSoftwareLibDLL()
- {
- // create a new CDynLinkLibrary for this app
- new CDynLinkLibrary(WarSoftwareLibDLL);
- CNotificationWnd* pWnd = new CNotificationWnd;
- pWnd->m_hWnd = NULL;
- if (!pWnd->CreateEx(0, AfxRegisterWndClass(0),
- _T("War Software Notification Sink"),
- WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL))
- {
- TRACE0("Warning: unable to create War Software notify window!n");
- AfxThrowResourceException();
- }
- ASSERT(pWnd->m_hWnd != NULL);
- ASSERT(CWnd::FromHandlePermanent(pWnd->m_hWnd) == pWnd);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CNotificationWnd implementation
- CWnd *CNotificationWnd::m_pWnd = NULL;
- CWinThread *CNotificationWnd::m_pThread = NULL;
- CNotificationWnd::CNotificationWnd()
- {
- m_pWnd = this;
- m_pThread = AfxGetThread();
- }
- CNotificationWnd::~CNotificationWnd()
- {
- m_pWnd = NULL;
- m_pThread = NULL;
- }
- LRESULT CNotificationWnd::OnRctdreq(WPARAM WParam, LPARAM LParam)
- {
- CRemoteInterface *pRI = (CRemoteInterface *)WParam;
- CRemoteRequest *pRR = (CRemoteRequest *)LParam;
- return (LRESULT)pRI->Request(pRR);
- }
- LRESULT CNotificationWnd::OnlogLine(WPARAM WParam, LPARAM LParam)
- {
- CLog *pLog = (CLog *)WParam;
- LPCSTR Text = (LPCSTR)LParam;
- pLog->LoggedLine(0, Text);
- return TRUE;
- }
- LONG CNotificationWnd::OnTrayIconMessage(WPARAM WParam, LPARAM LParam)
- {
- if (m_OnTrayIconMessage)
- return m_OnTrayIconMessage(WParam, LParam);
- return FALSE;
- }
- LRESULT CNotificationWnd::OnDNS(WPARAM WParam, LPARAM LParam)
- {
- CDNSLookup::DNSlookupCallback(WParam, LParam);
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // Message table implementation
- BEGIN_MESSAGE_MAP(CNotificationWnd, CWnd)
- //{{AFX_MSG_MAP(CWnd)
- //}}AFX_MSG_MAP
- ON_MESSAGE(WMU_RCTDREQ, OnRctdreq)
- ON_MESSAGE(WMU_LOGGEDLINE, OnlogLine)
- ON_MESSAGE(WMU_SNM,OnTrayIconMessage)
- ON_MESSAGE(WMU_TX_DNS, OnDNS)
- END_MESSAGE_MAP()