home *** CD-ROM | disk | FTP | other *** search
- /*
- This object has one method and one property that are available via OLE
- automation. The property allows you to set the value of a string, and
- the method shows the string in a dialog.
-
- For this example to work, you need to run the TestAp program, stored in this
- same directory. Before running TestAp, you should run this program once,
- passing in /regserver as the program's sole parameter.
-
- Open up the DPR file to see the call to Automation.ServerRegistration. }
- */
-
- int Initialization();
- static int Initializer = Initialization();
-
- #undef RegisterClass
-
- #include "myauto.h"
- #include <Dialogs.hpp>
-
- __fastcall TMyAuto::TMyAuto() : TAutoObject(){
- }
-
- void __fastcall TMyAuto::ShowDialog(){
- if (FMyProp == ""){
- FMyProp = "This object has a property called MyProp";
- ShowMessage(FMyProp);
- }
- }
-
- void __fastcall TMyAuto::SetMyProp(String S){
- ShowMessage("In SetMyProp()");
- ShowMessage(S);
-
- FMyProp = S;
- }
-
- String __fastcall TMyAuto::GetMyProp(){
- ShowMessage("In GetMyProp()");
- return FMyProp;
- }
-
- void RegisterMyAuto(){
- TAutoClassInfo AutoClassInfo;
- AutoClassInfo.AutoClass = __classid(TMyAuto);
- AutoClassInfo.ProgID = "AUTOPROJ.MyAuto";
- AutoClassInfo.ClassID = "{FE67CF61-2EDD-11CF-B536-0080C72EFD43}";
- AutoClassInfo.Description = "Sam";
- AutoClassInfo.Instancing = acMultiInstance;
-
- Automation->RegisterClass(AutoClassInfo);
- }
-
- int Initialization(){
- RegisterMyAuto();
- return 0;
- }
-
-
-