_stprintf(fileName, _T("%s-%04d-%02d-%02d-%02d-%02d-%02d-%03d.jpeg"), argv[1], lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
That will do what you want, but since you're using C++ you would be best to use a stringstream instead.
#include <stringstream>
int main(int argc, char** argv)
{
std::stringstream ss;
ss << argv[1] << "-" << lt.wYear << "-" << lt.wMonth << "-" << lt.wDay << "-" << lt.wHour << "-" << lt.wMinute << "-" << lt.wSecond << "-" << lt.wMilliseconds << ".jpeg";
}
You can then access the string with ss.str(). You can also use the same stream format modifiers you would use with any output stream.