CUDA sample code error

Hi, I downloaded the CUDA decoder D3D9 sample code and try to compile and run it with
g_bUseDisplay = true;
but i am getting an error at this command of call stack
g_pD3DDevice->SetViewport(&oViewport);

Can you please help me out here, whats the problem as there is no certain problem specify. Also i wanna use H.264 file to decode and save is as an output file. Any hint on how can i save the decoded frame in a video file. I am new to parallel programming and trying to figure things out. Any help will be appreciated. Thank you.