GME  13
MgaLauncher.h
Go to the documentation of this file.
00001 
00002 #ifndef MGA_MGALAUNCHER_H
00003 #define MGA_MGALAUNCHER_H
00004 
00005 // --------------------------- CMgaLauncher
00006 
00007 class ATL_NO_VTABLE CMgaLauncher : 
00008         public CComObjectRootEx<CComSingleThreadModel>,
00009         public CComCoClass<CMgaLauncher, &__uuidof(MgaLauncher)>,
00010         public IDispatchImpl<IMgaLauncher, &__uuidof(IMgaLauncher), &__uuidof(__MGAUtilLib)>
00011 {
00012 public:
00013         CMgaLauncher() { }
00014 
00015 DECLARE_REGISTRY_RESOURCEID(IDR_MGALAUNCHER)
00016 
00017 DECLARE_PROTECT_FINAL_CONSTRUCT()
00018 
00019 BEGIN_COM_MAP(CMgaLauncher)
00020         COM_INTERFACE_ENTRY(IMgaLauncher)
00021         COM_INTERFACE_ENTRY(IDispatch)
00022 END_COM_MAP()
00023 
00024 // ------- Properties
00025 
00026 public:
00027         CString paradigmname;
00028         componenttype_enum comptype;
00029         CComVariant parameter;
00030 
00031         CString connstr;
00032         CString progid;
00033         CComObjPtr<IMgaMetaProject> paradigm;
00034 
00035 // ------- Methods
00036 
00037 public:
00038         STDMETHOD(put_ParadigmName)(BSTR p);
00039         STDMETHOD(put_Parameter)(VARIANT newVal);
00040         STDMETHOD(put_ComponentType)(componenttype_enum type);
00041 
00042         STDMETHOD(get_ParadigmName)(BSTR *p);
00043         STDMETHOD(get_ConnStr)(BSTR *p);
00044         STDMETHOD(get_ProgID)(BSTR *p);
00045         STDMETHOD(get_Paradigm)(IMgaMetaProject **p);
00046 
00047         STDMETHOD(MetaDlg)(metadlg_enum flags);
00048         STDMETHOD(GmeDlg)();
00049         STDMETHOD(ComponentDlg)(componentdlg_enum flags);
00050         STDMETHOD(PropDlg)(IMgaObject * obj);
00051         STDMETHOD(AttrDlg)(IMgaObject * obj);
00052         STDMETHOD(ShowHelp)(IMgaObject * obj);
00053         STDMETHOD(RegistryBrowser)(IMgaObject * obj);
00054         STDMETHOD(AnnotationBrowser)(IMgaObject * obj, IMgaRegNode * focus);
00055 
00056         
00057         STDMETHOD(RunComponent)(BSTR progid, IMgaProject *project, IMgaFCO *focusobj, IMgaFCOs *selectedobjs, long param);
00058 // ------- Helper functions
00059 
00060         void ThrowCOMError(HRESULT hr, const wchar_t* err)
00061         {
00062                 ICreateErrorInfoPtr errCreate;
00063                 if (SUCCEEDED(CreateErrorInfo(&errCreate))
00064                         && SUCCEEDED(errCreate->SetDescription(const_cast<wchar_t*>(err)))
00065                         && SUCCEEDED(errCreate->SetGUID(__uuidof(IMgaLauncher)))
00066                         && SUCCEEDED(errCreate->SetSource(L"Mga.MgaLauncher"))
00067                         )
00068                 {
00069                         IErrorInfoPtr errorInfo = errCreate;
00070                         if (errorInfo)
00071                         {
00072                                 throw _com_error(hr, errorInfo.Detach());
00073                         }
00074                 }
00075                 throw _com_error(hr);
00076         }
00077 
00078 public:
00079         static CString PruneConnectionString(const CString &conn);
00080 };
00081 
00082 #endif//MGA_MGALAUNCHER_H