Click here to Skip to main content
15,895,192 members
Home / Discussions / COM
   

COM

 
AnswerRe: How to get image from IHTMLImgElement ? Pin
sdc39528-May-09 4:36
sdc39528-May-09 4:36 
Questionhow to ping message in wireless network Pin
alish061015-Apr-09 3:04
alish061015-Apr-09 3:04 
Questionerror "Missing file: ---- Urgent Pin
shantanusenin14-Apr-09 18:44
shantanusenin14-Apr-09 18:44 
QuestionRe: Call C# DLL using C++ - "Not enough storage is available to complete this operation" [modified] Pin
mla15414-Apr-09 8:42
mla15414-Apr-09 8:42 
AnswerRe: Call C# DLL using C++ - "Not enough storage is available to complete this operation" Pin
mla15415-Apr-09 10:55
mla15415-Apr-09 10:55 
QuestionUnable to emit assembly: Referenced assembly 'Interop.ADODB' does not have a strong name Pin
MarcelloTurnbull14-Apr-09 6:37
MarcelloTurnbull14-Apr-09 6:37 
AnswerRe: Unable to emit assembly: Referenced assembly 'Interop.ADODB' does not have a strong name Pin
mla15415-Apr-09 7:53
mla15415-Apr-09 7:53 
Questionout process server crash......... Pin
contactjey13-Apr-09 6:11
contactjey13-Apr-09 6:11 
Hi all,

I am new to COM,

and i use MFC for developing com

I developed an out process server(Automation Server) and i exposed a singleton comobject to outside world

to achieve singleton what i have done is inherited a class from COleObjectFactory and override the OnCreateObject in the derived class and it looks like this

CCmdTarget* CSingletonFactory::OnCreateObject()
{
//static CServer m_sServer;
//return &m_sServer;
if (m_Server == NULL)
{
m_Server = new CServer;
}
return m_Server;
}

and i wrote a client that too in MFC which just creates the object every time i click start button
(here always it returns same object's IDispatch pointer)


void CComClientDlg::OnBnClickedStart()
{
// TODO: Add your control notification handler code here

CLSID id = { 0xe856e42c, 0xe479, 0x4008, {0xb2, 0xf8, 0x1, 0xec, 0x9e, 0x5a, 0x84, 0x63} };
COSERVERINFO si;
si.pwszName = OLESTR("127.0.0.1");
si.pAuthInfo = NULL;
si.dwReserved1 = 0;
si.dwReserved2 = 0;
MULTI_QI rgmqi;
rgmqi.pIID = &IID_IDispatch;
rgmqi.pItf=NULL;
rgmqi.hr=S_OK;
HRESULT hresult = ::CoCreateInstanceEx(
id,
NULL,
CLSCTX_LOCAL_SERVER,
&si, 1, &rgmqi);
if (hresult == S_OK)
{
//hmmm success
;
}
}


but wat happens is when i click the start button 6 times my server is getting crashed Frown | :(
running in debugger alone i could able to find the crash(if not in debugger my server is getting shutdown silently and opening again)

In Debugging what i have found is the reference count of my object is steady getting reduced,

when i try to create the object first time(first time when the OnBnClickedStart is called) the ref count is 0 and next time it becomes 4(i dono how) and when i continuously call OnBnClickedStart for six time server crashes)

am i missing some thing here?

As it is a singleton should i give my one addref and release?

help me please


Thanks,
Jey

jey

QuestionTAPI Looking for minimum required code for making outgoing calls Pin
Ron Segijn12-Apr-09 0:30
Ron Segijn12-Apr-09 0:30 
QuestionAtlAxAttachControl - An outgoing call cannot be made since the application is dispatching an input-syncronous call. Pin
bfoo759-Apr-09 13:20
bfoo759-Apr-09 13:20 
QuestionHow to create new object in C# for reading COM port. Pin
gaurav_quexst9-Apr-09 1:57
gaurav_quexst9-Apr-09 1:57 
AnswerRe: How to create new object in C# for reading COM port. [modified] Pin
Vozzie29-Apr-09 6:23
Vozzie29-Apr-09 6:23 
QuestionAdd-in express.. Pin
gothic_coder9-Apr-09 1:11
gothic_coder9-Apr-09 1:11 
QuestionIs VariantChangeType() have problem with BSTR to VT_I4 conversion with even numbers and odd numbers Pin
Shankarcodebase8-Apr-09 5:48
Shankarcodebase8-Apr-09 5:48 
AnswerRe: Is VariantChangeType() have problem with BSTR to VT_I4 conversion with even numbers and odd numbers Pin
Ujjwal Gangwal11-Jun-19 6:05
professionalUjjwal Gangwal11-Jun-19 6:05 
QuestionDLL missing? Pin
tom5720078-Apr-09 2:49
tom5720078-Apr-09 2:49 
AnswerRe: DLL missing? Pin
tom5720078-Apr-09 2:57
tom5720078-Apr-09 2:57 
QuestionVB ActiveX in C# Pin
tvks8-Apr-09 2:13
tvks8-Apr-09 2:13 
Questionhow to fix the IWebBrowser2 refresh problem Pin
benpeng2-Apr-09 22:56
benpeng2-Apr-09 22:56 
QuestionFree threaded model Pin
_80862-Apr-09 21:25
_80862-Apr-09 21:25 
AnswerRe: Free threaded model Pin
Roger Stoltz2-Apr-09 21:50
Roger Stoltz2-Apr-09 21:50 
GeneralRe: Free threaded model Pin
_80862-Apr-09 22:43
_80862-Apr-09 22:43 
GeneralRe: Free threaded model Pin
_80862-Apr-09 22:53
_80862-Apr-09 22:53 
AnswerRe: Free threaded model Pin
Roger Stoltz2-Apr-09 23:04
Roger Stoltz2-Apr-09 23:04 
GeneralRe: Free threaded model Pin
_80862-Apr-09 23:16
_80862-Apr-09 23:16 

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.