123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <windows.h>
- #define __PLUGIN_DLL_EXPORT__
- #include "VMS0100MZ.h"
- #include "VMS0400MF.h"
- #include "TestFormF.h"
- USEFORM("VMS0400MF.cpp", VMS0400M);
- #pragma hdrstop
- //---------------------------------------------------------------------------
- // Important note about DLL memory management when your DLL uses the
- // static version of the RunTime Library:
- //
- // If your DLL exports any functions that pass String objects (or structs/
- // classes containing nested Strings) as parameter or function results,
- // you will need to add the library MEMMGR.LIB to both the DLL project and
- // any other projects that use the DLL. You will also need to use MEMMGR.LIB
- // if any other projects which use the DLL will be performing new or delete
- // operations on any non-TObject-derived classes which are exported from the
- // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
- // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
- // the file BORLNDMM.DLL should be deployed along with your DLL.
- //
- // To avoid using BORLNDMM.DLL, pass string information using "char *" or
- // ShortString parameters.
- //
- // If your DLL uses the dynamic version of the RTL, you do not need to
- // explicitly add MEMMGR.LIB as this will be done implicitly for you
- //---------------------------------------------------------------------------
- #pragma argsused
- #define STRICT
- #include <windows.h>
- #include <algorithm>
- using std::min;
- using std::max;
- #include "gdiplus.h"
- #include "GdiplusBase.h" //Ç×»ó ³Ö¾î µÐ´Ù.
- class CGdiPlusStarter
- {
- private:
- ULONG_PTR m_gpToken;
- public:
- bool m_bSuccess;
- CGdiPlusStarter()
- {
- ::CoInitialize(NULL);
- Gdiplus::GdiplusStartupInput gpsi;
- m_bSuccess = (Gdiplus::GdiplusStartup(&m_gpToken, &gpsi, NULL) == Gdiplus::Ok);
- dxInitialize();
- }
- ~CGdiPlusStarter()
- {
- dxInitialize();
- Gdiplus::GdiplusShutdown(m_gpToken);
- ::CoUninitialize();
- }
- };
- CGdiPlusStarter g_gps;
- PLUGIN_LIB void __stdcall ShowVmsForm(HWND Owner/*=NULL*/,
- HWND Parent/*=NULL*/,
- bool AIsMdiChild,
- bool bShowModal/*=false*/)
- {
- TVMS0400M *VMS0400M = NULL;
- try
- {
- VMS0400M = new TVMS0400M((TComponent*)Owner);
- if (Parent) VMS0400M->Parent = (TWinControl*)Parent;
- if (bShowModal)
- {
- VMS0400M->ShowModal();
- //delete VMS0400M;
- VMS0400M = NULL;
- }
- else
- {
- VMS0400M->Show();
- }
- }
- catch(...)
- {
- if (VMS0400M)
- {
- delete VMS0400M;
- VMS0400M = NULL;
- }
- }
- //return (HWND)VMS0400M->Handle;
- }
- PLUGIN_LIB void __stdcall ShowVmsForm2()
- {
- TTestForm *TestForm = NULL;
- try
- {
- TestForm = new TTestForm(NULL);
- TestForm->ShowModal();
- }
- catch(...)
- {
- if (TestForm)
- {
- delete TestForm;
- TestForm = NULL;
- }
- }
- }
- PLUGIN_LIB void __stdcall ShowVmsForm3()
- {
- TTestForm *TestForm = NULL;
- try
- {
- TestForm = new TTestForm(NULL);
- TestForm->Show();
- }
- catch(...)
- {
- if (TestForm)
- {
- delete TestForm;
- TestForm = NULL;
- }
- }
- }
- class SomeClass
- {
- public:
- SomeClass() {
- };
- ~SomeClass() {
- }
- public:
- };
- BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID)
- //int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
- {
- static SomeClass *someClass = NULL;
- if (reason == DLL_PROCESS_ATTACH) {
- try {
- if (!someClass) {
- someClass = new SomeClass();
- }
- } catch(...) {}
- }
- else
- if (reason == DLL_PROCESS_DETACH) {
- try {
- if (someClass) {
- //delete someClass;
- //someClass = NULL;
- }
- } catch(...) {}
- }
- return 1;
- }
- //---------------------------------------------------------------------------
|