VMS0400MZ.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <windows.h>
  4. #define __PLUGIN_DLL_EXPORT__
  5. #include "VMS0400MF.h"
  6. USEFORM("VMS0400MF.cpp", VMS0400M); // 추가된 폼의 cpp파일 내용의
  7. // extern PACKAGE TdllFrm *dllFrm;
  8. // 이부분에서 dllFrm참조 폼명을 적으면
  9. //
  10. // TdllFrm* dllFrm => 처럼 하지 않아도 됩니다.
  11. //
  12. // 작성된 dllFrm 포인터를 바로 사용할수 있습니다.
  13. #pragma hdrstop
  14. //---------------------------------------------------------------------------
  15. // Important note about DLL memory management when your DLL uses the
  16. // static version of the RunTime Library:
  17. //
  18. // If your DLL exports any functions that pass String objects (or structs/
  19. // classes containing nested Strings) as parameter or function results,
  20. // you will need to add the library MEMMGR.LIB to both the DLL project and
  21. // any other projects that use the DLL. You will also need to use MEMMGR.LIB
  22. // if any other projects which use the DLL will be performing new or delete
  23. // operations on any non-TObject-derived classes which are exported from the
  24. // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
  25. // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
  26. // the file BORLNDMM.DLL should be deployed along with your DLL.
  27. //
  28. // To avoid using BORLNDMM.DLL, pass string information using "char *" or
  29. // ShortString parameters.
  30. //
  31. // If your DLL uses the dynamic version of the RTL, you do not need to
  32. // explicitly add MEMMGR.LIB as this will be done implicitly for you
  33. //---------------------------------------------------------------------------
  34. #pragma argsused
  35. PLUGIN_LIB TPlugInForm * __stdcall ShowPlugInForm(ST_PlugInData *pPlugIn,
  36. TComponent *Owner/*=NULL*/,
  37. TComponent *Parent/*=NULL*/,
  38. TFormStyle nFormStyle/*=fsMDIChild*/,
  39. bool bShowModal/*=false*/)
  40. {
  41. TVMS0400M *VMS0400M = NULL;
  42. try
  43. {
  44. VMS0400M = new TVMS0400M(Owner);
  45. if (Parent) VMS0400M->Parent = (TWinControl*)Parent;
  46. VMS0400M->m_PlugIn.lpData1 = pPlugIn->lpData1;
  47. VMS0400M->m_PlugIn.lpData2 = pPlugIn->lpData2;
  48. VMS0400M->m_PlugIn.lpData3 = pPlugIn->lpData3;
  49. VMS0400M->m_PlugIn.lpData4 = pPlugIn->lpData4;
  50. VMS0400M->m_PlugIn.lpData5 = pPlugIn->lpData5;
  51. if (bShowModal)
  52. {
  53. VMS0400M->ShowModal();
  54. //delete VMS0400M;
  55. VMS0400M = NULL;
  56. }
  57. else
  58. {
  59. VMS0400M->Show();
  60. }
  61. }
  62. catch(...)
  63. {
  64. if (VMS0400M)
  65. {
  66. delete VMS0400M;
  67. VMS0400M = NULL;
  68. }
  69. }
  70. return (TPlugInForm *)VMS0400M;
  71. }
  72. PLUGIN_LIB TPlugInForm * __stdcall GetPlugInForm (ST_PlugInData *pPlugIn, TComponent *Owner/*=NULL*/, TComponent *Parent/*=NULL*/, TFormStyle nFormStyle/*=fsMDIChild*/)
  73. {
  74. TVMS0400M *VMS0400M = NULL;
  75. try
  76. {
  77. VMS0400M = new TVMS0400M(Owner);
  78. VMS0400M->m_PlugIn.lpData1 = pPlugIn->lpData1;
  79. VMS0400M->m_PlugIn.lpData2 = pPlugIn->lpData2;
  80. VMS0400M->m_PlugIn.lpData3 = pPlugIn->lpData3;
  81. VMS0400M->m_PlugIn.lpData4 = pPlugIn->lpData4;
  82. VMS0400M->m_PlugIn.lpData5 = pPlugIn->lpData5;
  83. if (Parent) VMS0400M->Parent = (TWinControl*)Parent;
  84. VMS0400M->FormStyle = nFormStyle;
  85. }
  86. catch(...)
  87. {
  88. if (VMS0400M)
  89. {
  90. delete VMS0400M;
  91. VMS0400M = NULL;
  92. }
  93. }
  94. return (TPlugInForm *)VMS0400M;
  95. }
  96. int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
  97. {
  98. #ifdef FREELIBMSG
  99. if (reason == DLL_PROCESS_DETACH)
  100. {
  101. try {
  102. if (!ITSDb_IsApplicationTerm()) {
  103. ST_WMMESSAGE *pWmMsg = new ST_WMMESSAGE;
  104. pWmMsg->hWnd = (HWND)NULL;
  105. pWmMsg->pForm = (void*)NULL;
  106. pWmMsg->sSender = "VMS0400M";
  107. pWmMsg->sReceiver = "";
  108. pWmMsg->sMsg = "";
  109. pWmMsg->nMsg = DLL_PROCESSDETACH;
  110. PostMessage(Application->MainForm->Handle, WM_PLUGINFORM, (WPARAM)pWmMsg, 0);
  111. }
  112. } catch(...) {}
  113. }
  114. #endif
  115. return 1;
  116. }
  117. //---------------------------------------------------------------------------