Click here to Skip to main content
15,897,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Child Windows Pin
Randor 15-Sep-09 1:43
professional Randor 15-Sep-09 1:43 
QuestionRe: Child Windows Pin
David Crow15-Sep-09 3:06
David Crow15-Sep-09 3:06 
Questionhow to clear the session? Pin
shru_dhuri14-Sep-09 18:59
shru_dhuri14-Sep-09 18:59 
AnswerRe: how to clear the session? Pin
«_Superman_»14-Sep-09 19:27
professional«_Superman_»14-Sep-09 19:27 
QuestionRead Text from Image file Pin
Game-point14-Sep-09 18:38
Game-point14-Sep-09 18:38 
AnswerRe: Read Text from Image file Pin
«_Superman_»14-Sep-09 19:33
professional«_Superman_»14-Sep-09 19:33 
AnswerRe: Read Text from Image file Pin
Cedric Moonen14-Sep-09 20:21
Cedric Moonen14-Sep-09 20:21 
QuestionCoCreateInstance getting the wrong coclass Pin
PaulowniaK14-Sep-09 17:01
PaulowniaK14-Sep-09 17:01 
I have a whole bunch of coclasses and corresponding interfaces.

I want to get an interface, IA, say:

IA* pIA;
CComPtr<IUnknown> pIUnknown;
pIUnknown.CoCreateInstance(__uuidof(A));
pIUnknown->QueryInterface(__uuidof(IA), (LPVOID*)&pIA);


But I also have coclass B and interface IB.

When I run this piece of code, __uuidof(A) is definitely getting the CLSID of A and not B (I've chased it down as far as I can go):

__checkReturn HRESULT CoCreateInstance(__in REFCLSID rclsid, __in_opt LPUNKNOWN pUnkOuter = NULL, __in DWORD dwClsContext = CLSCTX_ALL) throw()
{
    ATLASSERT(p == NULL);
    return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&p);
}


But, "p" in the above code points to B and no to A, despite rclsid clearly showing CLSID of A.

I've gone through my code several times checking order of things being declared, variables not getting cleared when reused, GUIDs getting mixed up etc. None of these seem to be the problem. In fact, CoCreateInstance to this coclass works fine in other parts of the program. It just fails in this particular instance.

Any ideas how to approach this problem?

Please help!
AnswerRe: CoCreateInstance getting the wrong coclass Pin
Stuart Dootson14-Sep-09 20:39
professionalStuart Dootson14-Sep-09 20:39 
GeneralRe: CoCreateInstance getting the wrong coclass Pin
PaulowniaK14-Sep-09 20:43
PaulowniaK14-Sep-09 20:43 
AnswerRe: CoCreateInstance getting the wrong coclass Pin
Stuart Dootson15-Sep-09 0:42
professionalStuart Dootson15-Sep-09 0:42 
QuestionCode Help Pin
MrMcIntyre14-Sep-09 10:45
MrMcIntyre14-Sep-09 10:45 
QuestionRe: Code Help Pin
CPallini14-Sep-09 11:15
mveCPallini14-Sep-09 11:15 
AnswerRe: Code Help Pin
Richard MacCutchan14-Sep-09 11:43
mveRichard MacCutchan14-Sep-09 11:43 
AnswerRe: Code Help Pin
Adam Roderick J14-Sep-09 18:01
Adam Roderick J14-Sep-09 18:01 
Question[Message Deleted] Pin
Jim Fell14-Sep-09 9:45
Jim Fell14-Sep-09 9:45 
AnswerRe: Reading ASCII File TAB is Replace with NULL Pin
David Crow14-Sep-09 10:06
David Crow14-Sep-09 10:06 
QuestionActive windows Pin
mishudev14-Sep-09 8:58
mishudev14-Sep-09 8:58 
AnswerRe: Active windows Pin
Randor 14-Sep-09 9:52
professional Randor 14-Sep-09 9:52 
QuestionSetting a controls background to transparent Pin
Deepak.Prahlad14-Sep-09 7:47
Deepak.Prahlad14-Sep-09 7:47 
AnswerRe: Setting a controls background to transparent Pin
Randor 14-Sep-09 9:50
professional Randor 14-Sep-09 9:50 
GeneralRe: Setting a controls background to transparent Pin
Deepak.Prahlad14-Sep-09 19:22
Deepak.Prahlad14-Sep-09 19:22 
GeneralRe: Setting a controls background to transparent Pin
Randor 15-Sep-09 0:19
professional Randor 15-Sep-09 0:19 
GeneralRe: Setting a controls background to transparent Pin
Deepak.Prahlad15-Sep-09 1:08
Deepak.Prahlad15-Sep-09 1:08 
GeneralRe: Setting a controls background to transparent Pin
Randor 15-Sep-09 3:06
professional Randor 15-Sep-09 3:06 

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.