WarSoftwareLib.cpp
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:4k
源码类别:

Ftp客户端

开发平台:

Visual C++

  1. // This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase
  2. // Copyright 1996 by Jarle Aase. All rights reserved.
  3. // See the "War Software Series Licende Agreement" for details concerning 
  4. // use and distribution.
  5. // ---
  6. // This source code, executables and programs containing source code or
  7. // binaries or proprietetary technology from the War Software Series are
  8. // NOT alloed used, viewed or tested by any governmental agencies in
  9. // any countries. This includes the government, departments, police, 
  10. // military etc.
  11. // ---
  12. // This file is intended for use with Tab space = 2
  13. // Created and maintained in MSVC Developer Studio
  14. // ---
  15. // NAME : WarSoftwareLib.cpp
  16. // PURPOSE : Defines the initialization routines for the DLL.
  17. // PROGRAM : 
  18. // DATE : Sept. 19 1996
  19. // AUTHOR : Jarle Aase
  20. // ---
  21. // REVISION HISTORY
  22. #include "stdafx.h"
  23. #include "resource.h"
  24. #include "..IncludeWarSoftware.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. #include <afxdllx.h>
  31. static AFX_EXTENSION_MODULE WarSoftwareLibDLL = { NULL, NULL };
  32. extern "C" int APIENTRY
  33. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  34. {
  35. if (dwReason == DLL_PROCESS_ATTACH)
  36. {
  37. TRACE0("WARSOFTWARELIB.DLL Initializing!n");
  38. // Extension DLL one-time initialization
  39. AfxInitExtensionModule(WarSoftwareLibDLL, hInstance);
  40. }
  41. else if (dwReason == DLL_PROCESS_DETACH)
  42. {
  43. TRACE0("WARSOFTWARELIB.DLL Terminating!n");
  44. }
  45. return 1;   // ok
  46. }
  47. // Exported DLL initialization is run in context of running application
  48. extern "C" void WINAPI InitWarSoftwareLibDLL()
  49. {
  50. // create a new CDynLinkLibrary for this app
  51. new CDynLinkLibrary(WarSoftwareLibDLL);
  52. CNotificationWnd* pWnd = new CNotificationWnd;
  53. pWnd->m_hWnd = NULL;
  54. if (!pWnd->CreateEx(0, AfxRegisterWndClass(0),
  55. _T("War Software Notification Sink"),
  56. WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL))
  57. {
  58. TRACE0("Warning: unable to create War Software notify window!n");
  59. AfxThrowResourceException();
  60. }
  61. ASSERT(pWnd->m_hWnd != NULL);
  62. ASSERT(CWnd::FromHandlePermanent(pWnd->m_hWnd) == pWnd);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CNotificationWnd implementation
  66. CWnd *CNotificationWnd::m_pWnd = NULL;
  67. CWinThread *CNotificationWnd::m_pThread = NULL;
  68. CNotificationWnd::CNotificationWnd()
  69. {
  70. m_pWnd = this;
  71. m_pThread = AfxGetThread();
  72. }
  73. CNotificationWnd::~CNotificationWnd()
  74. {
  75. m_pWnd = NULL;
  76. m_pThread = NULL;
  77. }
  78. LRESULT CNotificationWnd::OnRctdreq(WPARAM WParam, LPARAM LParam)
  79. {
  80. CRemoteInterface *pRI = (CRemoteInterface *)WParam;
  81. CRemoteRequest *pRR = (CRemoteRequest *)LParam;
  82. return (LRESULT)pRI->Request(pRR);
  83. }
  84. LRESULT CNotificationWnd::OnlogLine(WPARAM WParam, LPARAM LParam)
  85. {
  86. CLog *pLog = (CLog *)WParam;
  87. LPCSTR Text = (LPCSTR)LParam;
  88. pLog->LoggedLine(0, Text);
  89. return TRUE;
  90. }
  91. LONG CNotificationWnd::OnTrayIconMessage(WPARAM WParam, LPARAM LParam)
  92. {
  93. if (m_OnTrayIconMessage)
  94. return m_OnTrayIconMessage(WParam, LParam);
  95. return FALSE;
  96. }
  97. LRESULT CNotificationWnd::OnDNS(WPARAM WParam, LPARAM LParam)
  98. {
  99. CDNSLookup::DNSlookupCallback(WParam, LParam);
  100. return TRUE;
  101. }
  102. /////////////////////////////////////////////////////////////////////////////
  103. // Message table implementation
  104. BEGIN_MESSAGE_MAP(CNotificationWnd, CWnd)
  105. //{{AFX_MSG_MAP(CWnd)
  106. //}}AFX_MSG_MAP
  107. ON_MESSAGE(WMU_RCTDREQ, OnRctdreq)
  108. ON_MESSAGE(WMU_LOGGEDLINE, OnlogLine)
  109. ON_MESSAGE(WMU_SNM,OnTrayIconMessage)
  110. ON_MESSAGE(WMU_TX_DNS, OnDNS)
  111. END_MESSAGE_MAP()