Click here to Skip to main content
15,890,527 members
Home / Discussions / COM
   

COM

 
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 
GeneralRe: Getting COM Error: Scalar deleting destructor. Pin
KTTransfer20-May-10 22:34
KTTransfer20-May-10 22:34 
GeneralRe: Getting COM Error: Scalar deleting destructor. Pin
Stephen Hewitt22-May-10 22:09
Stephen Hewitt22-May-10 22:09 
QuestionApplication attempted to perform an operation not allowed by the security policy Pin
NarVish19-May-10 1:38
NarVish19-May-10 1:38 
QuestionTROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified] Pin
K ARUN KUMAR17-May-10 18:22
K ARUN KUMAR17-May-10 18:22 
AnswerRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt17-May-10 19:59
Stephen Hewitt17-May-10 19:59 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR17-May-10 21:07
K ARUN KUMAR17-May-10 21:07 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt17-May-10 22:33
Stephen Hewitt17-May-10 22:33 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR17-May-10 23:30
K ARUN KUMAR17-May-10 23:30 

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.