The hint is the second parameter of substr.
The specification for substr states that the first parameter of substr is the starting position, where the second parameter is the size of the substr. Since you are currently passing in the length of the string then it is bounding it to the end of the string.
So you simply work out where you want the substring to end and then use that as the second parameter to substr.
As a hint:
size_t lastpos = strFilePath.rfind(L"\"");
Will get the position of the last quotation mark. You can then work out the difference between the two positions to get the size of the string.
Also, when you post code please post code that compiles. Assigning a narrow string literal to a std::wstring results in a compiler error. Also you can't have a single \ in the string literal. You need to escape it like you did in your rfind.
This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the
major point of my posts is to aid in the learning process.