1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
STDMETHODIMP TEnveloppeImpl::get_MyComplexClass(ComplexClass** Value)
{
try
{
HRESULT reponse;
reponse = this->complexClassImpl->CreateInstance(Value);
if(!SUCCEEDED(reponse))
switch(reponse){
case REGDB_E_CLASSNOTREG:
texte = "...";
Form1->Memo1->Lines->Add(texte);
break;
case E_NOINTERFACE:
texte = "...";
Form1->Memo1->Lines->Add(texte);
break;
case CLASS_E_NOAGGREGATION:
texte = "...";
Form1->Memo1->Lines->Add(texte);
break;
case CO_S_NOTALLINTERFACES:
texte = "...";
Form1->Memo1->Lines->Add(texte);
break;
default:
texte = "Reponse inconnue???: 0x";
AnsiString tmp;
tmp.IntToHex(reponse,8);
texte += tmp;
Form1->Memo1->Lines->Add(texte);
break;
}
else{
texte = "Location and connection to the specified class object was successful.";
Form1->Memo1->Lines->Add(texte);
}
// NOTE: cette methode permet de recopier les valeurs de complexClassImpl et les mets dans Value
this->complexClassImpl->update(Value);
long valeurTmp;
LPSTR phraseTmp;
(*Value)->get_nb(&valeurTmp);
(*Value)->get_phrase(&phraseTmp);
texte = "Nb: ";
texte += valeurTmp;
Form1->Memo1->Lines->Add(texte);
texte = "Phrase: ";
AnsiString tmp = phraseTmp;
texte += tmp;
Form1->Memo1->Lines->Add(texte);
}
catch(Exception &e)
{
return Error(e.Message.c_str(), IID_IEnveloppe);
}
return S_OK;
}; |
Partager