Отладка что показывает?
Код:
![Выделить весь код](images/misc/selectcode.png)
std::string errorMsg(const char* msg, int code)
{
std::ostringstream ss;
ss << msg << " failed with os error " << code;
return ss.str();
};
try
{
hwnd1 = FindWindow(...);
if (!hwnd1) throw std::runtime_error(errorMsg("FindWindow", GetLastError()));
if (!SetWindowPos(...)) throw std::runtime_error(errorMsg("SetWindowPos", GetLastError()));
}
catch(std::exception& e)
{
// вывод последней ошибки
MessageBox(0, e.what(), 0, MB_ICONERROR|MB_OK);
throw;
}