Home > Software engineering >  CoCreateInstance s_ok, but each time the contents of the Messagebox, newbie on the road are learning
CoCreateInstance s_ok, but each time the contents of the Messagebox, newbie on the road are learning

Time:09-24

Void themfull: : Onchkh ()
{
//TODO: Add your the control notification handler code here

//IID_Imcenter
//: : CoInitializeEx (NULL, COINIT_MULTITHREADED);
This - & gt; The UpdateData ();
Retrieves documents (=CoInitialize (NULL);

Pcenter Imcenterclass *;
Documents (=CoCreateInstance (CLSID_mcenterclass, NULL, CLSCTX_INPROC_SERVER, IID_Imcenterclass, (void * *) & amp; Pcenter);
If (FAILED (documents))
{
MessageBox (" generated interface error, at the beginning of may not make the com!" "Error");
: : CoUninitialize ();
return;
}

Documents (=pcenter - & gt; Center ();
CoUninitialize ();
return;

}

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

If (documents (==S_OK)
{
;
}

CodePudding user response:

To set breakpoints single-step observation

CodePudding user response:

The documents (print and see what content

CodePudding user response:

S_OK definition is 0 l, judging FAILED is less than zero, you check your hr is really equal to zero, if FAILED to define what the other was changed

CodePudding user response:

reference 4 floor oyljerry response:
the documents print look, what content


Hello, I will return to show after the value of the documents (0 XCCCCCCCC, documents (REGDB_E_CLASSNOTREG Class not registered HRESULT, could you tell me how to do later? Thank you ~

CodePudding user response:

CLSID_mcenterclass without registration?

CodePudding user response:

refer to 7th floor schlafenhamster response:
CLSID_mcenterclass without registration?

Hello, I will return to show after the value of the documents (0 XCCCCCCCC, documents (REGDB_E_CLASSNOTREG Class not registered HRESULT, could you tell me how to do later? Thank you ~

CodePudding user response:

Com should bring registration file, run on machines registration documents,

CodePudding user response:

references 9 f schlafenhamster response:
com should bring registration file, run on machine register file,

Can you tell me the specific registration process, I understand, thank you ~

CodePudding user response:

Would you help me tell the CoCreateInstance function of clsids specific registration process, thank you!

CodePudding user response:

For example, shell extension "shellext. DLL" is a shellext. REG
Right-click to open the way to click on "compiler" registry will be registered, the text is shown as

REGEDIT4


[HKEY_CLASSES_ROOT \ clsids \ {87 b9bd00 - c65c CD - a259-00-11 dd010e8c28}]
@="Shell Extension Sample"
[HKEY_CLASSES_ROOT \ clsids \ {87 b9bd00 - c65c CD - a259-00-11 dd010e8c28} \ InProcServer32]
@="shellext. DLL"
"ThreadingModel"="Apartment"
...

CodePudding user response:

0 XCCCCCCCC is variable has no assignment state
Breakpoint is set on the if (FAILED) (documents), thus see the run results of documents (=CoCreateInstance

  • Related