conversion of window text to std::(w)string?
Brought to you by:
tringi
Just came to this simple problem: I have a class and I need to initialize its members (std::strings) by values that user entered into edit controls. This is perfect candidate of if-I-find-clean-safe-and-smart-yet-simple-solution-I-will-add-it-to-ext-library problem ;-) ...well actually it will be win::whatever :-)
I know that some .title member vartor to some very generic win::window class (or template) would be really nice, but that way I would need to implement a large pile of stuff, so I am going to think about some simpler solution.
If you already have invented something, please let me know as right now I haven't came up with anything.
Logged In: YES
user_id=1590239
Originator: YES
std::string function_name (HWND hWnd) {
std::vector <char> sz;
sz.resize (GetWindowTextLengthA (hWnd) + 1);
GetWindowTextA (hWnd, &sz [0], sz.size ());
return std::string (&sz [0]);
};