In C++ (specifically on Visual C++), sometimes you cannot open a file because another executable has it opened and is not sharing it for reads. If I try to open such a file
The MSDN approved way is IFileIsInUse::GetAppName(). Requires Vista, though.