Click here to Skip to main content
15,913,610 members
Home / Discussions / COM
   

COM

 
GeneralRe: Reverse engineering Information on MsOCF! Pin
Anonymous11-Apr-03 0:47
Anonymous11-Apr-03 0:47 
GeneralRe: Reverse engineering Information on MsOCF! Pin
safee ullah11-Apr-03 0:51
safee ullah11-Apr-03 0:51 
GeneralRe: Reverse engineering Information on MsOCF! Pin
Stephane Rodriguez.11-Apr-03 7:03
Stephane Rodriguez.11-Apr-03 7:03 
GeneralRe: Reverse engineering Information on MsOCF! Pin
safee ullah14-Apr-03 1:38
safee ullah14-Apr-03 1:38 
GeneralRe: Reverse engineering Information on MsOCF! Pin
Stephane Rodriguez.14-Apr-03 1:54
Stephane Rodriguez.14-Apr-03 1:54 
GeneralRe: Reverse engineering Information on MsOCF! Pin
safee ullah14-Apr-03 19:17
safee ullah14-Apr-03 19:17 
QuestionHow to mark MFC ActiveX as safe for scripting? Pin
Ted Christiansen27-Mar-03 7:30
Ted Christiansen27-Mar-03 7:30 
AnswerRe: How to mark MFC ActiveX as safe for scripting? Pin
Chris Richardson27-Mar-03 8:28
Chris Richardson27-Mar-03 8:28 
I have found some code in the MSDN to mark a control as safe for scripting. Here it is (slightly modified):

// MSDN CODE:
//
HRESULT CreateComponentCategory(CATID catid, WCHAR* catDescription)
{
   ICatRegister* pcr = NULL ;
   HRESULT hr = S_OK ;

   hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
      NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
   if (FAILED(hr))
      return hr;

   // Make sure the HKCR\Component Categories\{..catid...}
   // key is registered.
   CATEGORYINFO catinfo;
   catinfo.catid = catid;
   catinfo.lcid = 0x0409 ; // english

   // Make sure the provided description is not too long.
   // Only copy the first 127 characters if it is.
   int len = wcslen(catDescription);
   if (len>127)
      len = 127;
   wcsncpy(catinfo.szDescription, catDescription, len);
   // Make sure the description is null terminated.
   catinfo.szDescription[len] = '\0';

   hr = pcr->RegisterCategories(1, &catinfo);
   pcr->Release();

   return hr;
}

HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
{
   // Register your component categories information.
   ICatRegister* pcr = NULL ;
   HRESULT hr = S_OK ;
   hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
      NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
   if (SUCCEEDED(hr))
   {
      // Register this category as being "implemented" by the class.
      CATID rgcatid[1] ;
      rgcatid[0] = catid;
      hr = pcr->RegisterClassImplCategories(clsid, 1, rgcatid);
   }

   if (pcr != NULL)
      pcr->Release();

   return hr;
}

// I made this function a static member of my control.
/*static*/ HRESULT CYourActiveXControl::RegisterSafetyCategories()
{
   HRESULT hr = S_OK;
   hr = CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data!");
   if (FAILED(hr))
      return hr;

   hr = RegisterCLSIDInCategory(IID_YourActiveXControlHere, CATID_SafeForInitializing);
   if (FAILED(hr))
      return hr;

   // Mark the control as safe for scripting.

   hr = CreateComponentCategory(CATID_SafeForScripting, L"Controls safely scriptable!");
   if (FAILED(hr))
      return hr;

   hr = RegisterCLSIDInCategory(IID_YourActiveXControlHere, CATID_SafeForScripting);
   if (FAILED(hr))
      return hr;
   
   return hr;
}
//
// END MSDN CODE.


Then you can just call the static member "CYourActiveXControl::RegisterSafetyCategories()" in your app's InitInstance function.

Chris Richardson

You can stash and you can seize
In dreams begin, responsibilities

U2 - Acrobat[^]


Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your Beer | [beer] - Rohit Sinha in the content-challenged thread
GeneralRe: How to mark MFC ActiveX as safe for scripting? Pin
Ted Christiansen27-Mar-03 12:12
Ted Christiansen27-Mar-03 12:12 
GeneralRe: How to mark MFC ActiveX as safe for scripting? Pin
Chris Richardson27-Mar-03 13:33
Chris Richardson27-Mar-03 13:33 
GeneralCOM Method parameters Pin
Tzoockee26-Mar-03 5:34
Tzoockee26-Mar-03 5:34 
GeneralRe: COM Method parameters Pin
Tzoockee26-Mar-03 6:00
Tzoockee26-Mar-03 6:00 
GeneralRe: COM Method parameters Pin
thowra26-Mar-03 7:46
thowra26-Mar-03 7:46 
GeneralRe: COM Method parameters Pin
Vi226-Mar-03 20:19
Vi226-Mar-03 20:19 
GeneralRe: COM Method parameters Pin
AsimHussnain30-Mar-03 22:21
AsimHussnain30-Mar-03 22:21 
GeneralConvert CComBSTR to char* Pin
msh25-Mar-03 19:09
msh25-Mar-03 19:09 
GeneralRe: Convert CComBSTR to char* Pin
Michael Dunn25-Mar-03 19:31
sitebuilderMichael Dunn25-Mar-03 19:31 
GeneralCOM+ Partitions Pin
Anonymous25-Mar-03 11:41
Anonymous25-Mar-03 11:41 
GeneralEditable FlexGrid Control Pin
helloaamir24-Mar-03 1:29
helloaamir24-Mar-03 1:29 
GeneralRe: Editable FlexGrid Control Pin
Stephane Rodriguez.24-Mar-03 2:15
Stephane Rodriguez.24-Mar-03 2:15 
GeneralRe: Editable FlexGrid Control Pin
helloaamir24-Mar-03 18:02
helloaamir24-Mar-03 18:02 
GeneralRe: Editable FlexGrid Control Pin
Stephane Rodriguez.24-Mar-03 18:42
Stephane Rodriguez.24-Mar-03 18:42 
GeneralRe: Editable FlexGrid Control Pin
Dan Thurman3-Apr-03 7:04
Dan Thurman3-Apr-03 7:04 
GeneralRe: Editable FlexGrid Control Pin
Stephane Rodriguez.3-Apr-03 9:21
Stephane Rodriguez.3-Apr-03 9:21 
GeneralASP/ASP.NET PDF/Word search Obj Pin
johncogan20-Mar-03 4:31
johncogan20-Mar-03 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.