Click here to Skip to main content
16,005,734 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: MC++ & C++ Pin
Nish Nishant26-Jul-02 15:45
sitebuilderNish Nishant26-Jul-02 15:45 
GeneralRe: MC++ & C++ Pin
Joel Lucsy26-Jul-02 18:45
Joel Lucsy26-Jul-02 18:45 
GeneralRe: MC++ & C++ Pin
Nick Hodapp9-Aug-02 14:46
sitebuilderNick Hodapp9-Aug-02 14:46 
GeneralRe: MC++ & C++ Pin
Joel Lucsy9-Aug-02 16:33
Joel Lucsy9-Aug-02 16:33 
GeneralXMLTextWriter, Files and a Class Library Pin
Paul Watson26-Jul-02 0:47
sitebuilderPaul Watson26-Jul-02 0:47 
GeneralRe: XMLTextWriter, Files and a Class Library Pin
Nish Nishant26-Jul-02 8:10
sitebuilderNish Nishant26-Jul-02 8:10 
GeneralAfxOleInit, Rama and a puzzle! Pin
Nish Nishant24-Jul-02 17:48
sitebuilderNish Nishant24-Jul-02 17:48 
GeneralRe: AfxOleInit, Rama and a puzzle! Pin
Rama Krishna Vavilala26-Jul-02 4:35
Rama Krishna Vavilala26-Jul-02 4:35 
I had to look and go through your code to find this out.

1. AfxEnableControlContainer is automatically called by CHtmlView so it is not necessary. But still it is a good practice to have it in the InitInstance.

2. MFC requires AfxOleInit in order for control containment to work and I am surprised to see that in VS.NET it is automatically called during CreateControl. If that fails MFC cannot create controls.

Now to the actual answer.

Activator.GetObject or Activator.CreateInstance initialize COM automatically if it is not initialized and the default is to initialize is COINT_MULTITHREADED. So when MFC tries to call AfxOleInit (COINIT_APARTMENTTHREADED) the call fails because you cannot change the apartment type. So the control creation fails.

But when you call AfxOleInit in InitInstance Activator.GetObject sees that COM is initialized so it doesnot do anything and everything is fine.

Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
GeneralRe: AfxOleInit, Rama and a puzzle! Pin
Nish Nishant26-Jul-02 8:07
sitebuilderNish Nishant26-Jul-02 8:07 
GeneralProblem setting breakpoints Pin
Nish Nishant24-Jul-02 17:23
sitebuilderNish Nishant24-Jul-02 17:23 
GeneralRe: Problem setting breakpoints Pin
Nish Nishant24-Jul-02 17:27
sitebuilderNish Nishant24-Jul-02 17:27 
GeneralForcing GC Pin
Nish Nishant24-Jul-02 15:24
sitebuilderNish Nishant24-Jul-02 15:24 
GeneralRe: Forcing GC Pin
Rama Krishna Vavilala24-Jul-02 15:38
Rama Krishna Vavilala24-Jul-02 15:38 
GeneralRe: Forcing GC Pin
Nish Nishant24-Jul-02 15:51
sitebuilderNish Nishant24-Jul-02 15:51 
GeneralRe: Forcing GC Pin
Rama Krishna Vavilala24-Jul-02 15:53
Rama Krishna Vavilala24-Jul-02 15:53 
GeneralRe: Forcing GC Pin
Nish Nishant24-Jul-02 16:08
sitebuilderNish Nishant24-Jul-02 16:08 
GeneralRe: Forcing GC Pin
Rama Krishna Vavilala24-Jul-02 16:10
Rama Krishna Vavilala24-Jul-02 16:10 
GeneralRe: Forcing GC Pin
Nish Nishant24-Jul-02 17:18
sitebuilderNish Nishant24-Jul-02 17:18 
GeneralRe: Forcing GC Pin
James T. Johnson24-Jul-02 17:31
James T. Johnson24-Jul-02 17:31 
GeneralRe: Forcing GC Pin
Nish Nishant24-Jul-02 17:39
sitebuilderNish Nishant24-Jul-02 17:39 
GeneralRe: Forcing GC Pin
Rama Krishna Vavilala25-Jul-02 2:35
Rama Krishna Vavilala25-Jul-02 2:35 
GeneralRe: Forcing GC Pin
Nish Nishant25-Jul-02 4:16
sitebuilderNish Nishant25-Jul-02 4:16 
GeneralRe: Forcing GC Pin
Rama Krishna Vavilala24-Jul-02 16:35
Rama Krishna Vavilala24-Jul-02 16:35 
GeneralRe: Forcing GC Pin
Nish Nishant24-Jul-02 17:29
sitebuilderNish Nishant24-Jul-02 17:29 
GeneralRe: Forcing GC Pin
James T. Johnson24-Jul-02 15:58
James T. Johnson24-Jul-02 15:58 

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.