COM client structure
-
Sirs, this is my first COM adventure so I need your advise. I have an in process server with lots of interfaces and even more methods in it. The manufacturer of the dll provides a sample code snippet of how to get pointers to all the interfaces: //First object HRESULT hr = ::CoCreateInstance(... if ( !FAILED( hr ) ) { //First interface hr = pIUnknown->QueryInterface(... if ( !FAILED( hr ) ) { //Second interface hr = pIUnknown->QueryInterface(... if ( !FAILED( hr ) ) { //Third interface hr = pIUnknown->QueryInterface(... if ( !FAILED( hr ) ) { ... //Here comes the code that uses the interfaces ... } else { ...//Third interface failed } } else { ...//Second interface failed } } else { ...//First interface failed } } else { ...//CreateInstance failed } Why are the QI calls NESTED? I tried putting them after each other but the same code taken from the nested structure didn't work (Runtime library: abnormal program termination) although all interfaces were succesfully created. I would like to create the appropriate interfaces in my dialogs' OnInitdialogs and release in the OnDestroyWindow. Is that possible? Any sugggestions? Thanks for your help in advance. Bunburry A subject that is beautiful in itself gives no suggestion to the Artist. It lacks imperfection. (O.Wilde)