I don't do any Windows development, so I can't comment on the WideCharToMultiByte part being safe.
The one thing I would say though is to ensure you are using the proper types for everything. For example, string.length() returns a size_tstd::string::size_type (themost likely a size_t, the constructor also takes a size_tstd::string::size_type, but that one isn't as big of a deal). It probably won't ever bite you, but it is something to be careful of to ensure you don't have any overflows in other code you may be writing.