As stated in Seth's answer, you need a Windows message loop for the Canon SDK to work. No callbacks will be called if you are not processing the Windows messages.
Based on your code, you probably want to do something like this pseudocode:
bool bPhotoTaken = false;
main()
{
// Initialize EDSDK, start session with camera, change SaveTo property
// register ObjectEventHandler
// send kEdsCameraCommand_TakePicture
while((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
{
if(bRet == -1 || bPhotoTaken)
{
break;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// Cleanup EDSDK
}
and your ObjectEventHandler callback, upon recieving the DirItemRequestTransfer, will download the image, and then set bPhotoTaken=true;
, which will break the message loop and exit your application.