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

COM

 
GeneralRe: How to get flash handle(ocx) in bho Pin
Stephen Hewitt21-Jun-10 17:30
Stephen Hewitt21-Jun-10 17:30 
GeneralRe: How to get flash handle(ocx) in bho Pin
ZEROFIELD21-Jun-10 17:58
ZEROFIELD21-Jun-10 17:58 
QuestionIssues with MSMQ Events in W2K3 64 bit server Pin
Hariharan.T16-Jun-10 9:08
Hariharan.T16-Jun-10 9:08 
QuestionExposing C# COM server events to delphi client Pin
shilan_hk11-Jun-10 22:10
shilan_hk11-Jun-10 22:10 
Answercross-post Pin
Garth J Lancaster12-Jun-10 0:27
professionalGarth J Lancaster12-Jun-10 0:27 
GeneralRe: cross-post Pin
Stephen Hewitt20-Jun-10 15:30
Stephen Hewitt20-Jun-10 15:30 
Questionregenerate wrappers for ocx library Pin
eusto10-Jun-10 8:43
eusto10-Jun-10 8:43 
AnswerRe: regenerate wrappers for ocx library Pin
Cool_Dev10-Jun-10 19:11
Cool_Dev10-Jun-10 19:11 
AnswerRe: regenerate wrappers for ocx library Pin
«_Superman_»10-Jun-10 19:13
professional«_Superman_»10-Jun-10 19:13 
GeneralRe: regenerate wrappers for ocx library Pin
Stephen Hewitt10-Jun-10 19:45
Stephen Hewitt10-Jun-10 19:45 
GeneralRe: regenerate wrappers for ocx library Pin
eusto10-Jun-10 21:14
eusto10-Jun-10 21:14 
GeneralRe: regenerate wrappers for ocx library Pin
Stephen Hewitt11-Jun-10 18:46
Stephen Hewitt11-Jun-10 18:46 
Questioncom local server Pin
vasuvasanth7-Jun-10 23:06
vasuvasanth7-Jun-10 23:06 
AnswerRe: com local server Pin
Stephen Hewitt8-Jun-10 14:29
Stephen Hewitt8-Jun-10 14:29 
GeneralRe: com local server Pin
vasuvasanth8-Jun-10 21:40
vasuvasanth8-Jun-10 21:40 
GeneralRe: com local server Pin
Stephen Hewitt9-Jun-10 15:21
Stephen Hewitt9-Jun-10 15:21 
It's not hard to find out. I placed a breakpoint in CoRegisterClassObject and when it was hit had a look at the stack. The MFC function COleObjectFactory::Register seems to be where the action takes place. The code in question looks like this:
SCODE sc = ::CoRegisterClassObject(m_clsid, &m_xClassFactory,
			CLSCTX_LOCAL_SERVER,
			m_bMultiInstance ? REGCLS_SINGLEUSE : REGCLS_MULTIPLEUSE,
			&m_dwRegister);

Note the that the m_bMultiInstance member seems to be exactly what you're looking for. When I searched MFC's source for it I found this:
void COleTemplateServer::ConnectTemplate(
	REFCLSID clsid, CDocTemplate* pDocTemplate, BOOL bMultiInstance)

Which contains the following:
m_bMultiInstance = bMultiInstance;


This functions seems to be called from your application's InitInstance function:
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
	IDR_MFCEXETYPE,
	RUNTIME_CLASS(CMFCExeComServerDoc),
	RUNTIME_CLASS(CChildFrame), // custom MDI child frame
	RUNTIME_CLASS(CMFCExeComServerView));
AddDocTemplate(pDocTemplate);

// Connect the COleTemplateServer to the document template.
//  The COleTemplateServer creates new documents on behalf
//  of requesting OLE containers by using information
//  specified in the document template.
m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);


Change the underlined bit to TRUE are see how things go. Don't be scared to look at the source code for MFC (or whatever libraries you're using)!
Steve

Questionwant article for com and dcom Pin
Honeyboy_206-Jun-10 16:35
Honeyboy_206-Jun-10 16:35 
QuestionDirectshow Audio Question Pin
godspeed1233-Jun-10 8:07
godspeed1233-Jun-10 8:07 
QuestionMIDL2020 : error generating type library [modified] Pin
forexsurfr29-May-10 19:09
forexsurfr29-May-10 19:09 
AnswerRe: MIDL2020 : error generating type library Pin
forexsurfr30-May-10 7:29
forexsurfr30-May-10 7:29 
QuestionWindows 7 starting new app instance from Visual Studio 2005 Pin
StevenS_Dev21-May-10 9:42
StevenS_Dev21-May-10 9:42 
QuestionRe: Windows 7 starting new app instance from Visual Studio 2005 Pin
Randor 28-May-10 4:17
professional Randor 28-May-10 4:17 
AnswerRe: Windows 7 starting new app instance from Visual Studio 2005 Pin
StevenS_Dev28-May-10 7:38
StevenS_Dev28-May-10 7:38 
QuestionGetting COM Error: Scalar deleting destructor. Pin
KTTransfer20-May-10 21:10
KTTransfer20-May-10 21:10 
AnswerRe: Getting COM Error: Scalar deleting destructor. Pin
Stephen Hewitt20-May-10 21:54
Stephen Hewitt20-May-10 21:54 

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.