home *** CD-ROM | disk | FTP | other *** search
- #pragma option -xc //Safe exceptions
- #pragma option -WD //makes all functions in a DLL exportable
- #include <windows.h>
- #include <dos.h>
- #include <stdio.h>
- #include "delevent.h"
-
-
- //we use huge so that we can have far vtbls and not export the whole class
- class _huge TDLLClass{
- char Buffer[80];
- int InternalValue;
- TEvent FEvent;
-
- virtual void _pascal SetValue(int Info){InternalValue = Info;}
- virtual int _pascal GetValue(){return InternalValue;}
- virtual void _pascal SetEvent(TEvent func){FEvent = func;};
-
-
- public:
- TDLLClass():InternalValue(0){FEvent.Code = NULL;};
- //we only export what we deem needed
- virtual void _pascal ShowThevalue()
- {
- wsprintf(Buffer, "The value %d\nCOM to da Max!!!!",InternalValue);
- MessageBox(NULL,Buffer,"From The C++ DLL",MB_OK);
- }
-
- virtual void _pascal DoEvent()
- {
- if (FEvent.Code != NULL)
- ((TNotifyEvent)FEvent.Code)((const void *)this,FEvent.Self);
- }
- };
-
- extern "C" {
-
- TDLLClass* pascal _export ConstructClass()
- {
- return new TDLLClass;
- };
-
- void pascal _export DestructClass(TDLLClass *DLLClass)
- {
- if (DLLClass != NULL)
- delete DLLClass;
- };
- }
-
-