void main() { //any function name will do //Step 1 : Declare HRESULT and interface pointer //variables for IF1 and IF2 //Step 2 : Initialize COM - thread can use //COM services and objects. //Step 3 : Call CoCreateInstance to create an //instance of COM object O1, get a pointer to IF1. //Use the FAILED macro to check for errors. //Step 4 : Call method X1 in IF1. Pass in any value. hr = pIF1->X1(45); //Step 5 : Call IF1::QueryInterface to get a //pointer to IF2. Use the FAILED macro to check //for errors //Step 6 : Call Z1 in IF2 //Step 7 : Release all COM interface pointers //Step 8 : Uninitialize COM for this thread