Closed NipunRamani99 closed 5 years ago
maybe you could test changing the type to a wide string and see if that fixes it?
wait... I think it see a possible bug
Try adding \n to the end of the window name title after the copy is finished. It might be that it is not null terminated.
Yep, added a null terminator and that fixed the problem. This problem is caused by buffer parameter in GetWindowTextA() that is pointing to invalid window name string which is not null terminated.
awesome. did you want to do a pull request? Otherwise, ill fix this later today.
Just pushed a fix for this try it out https://github.com/smasherprog/screen_capture_lite/commit/5100aefcda98c17dfd02d3d73526bd81dd7d9a86
On Visual Studio 2017, When I tried the GetWindowFrame example, at the point where the EnumWindows() enumerates through processes it encounters a weird title name which crashes the program.![devenv_2018-09-21_12-30-29](https://user-images.githubusercontent.com/17413156/45865284-a3788d00-bd9a-11e8-857e-0a17716800b8.png)
Here is the weird name string:
I tested this part of the code seperately in CodeBlocks and it worked but it crashed in VS2017 but works on changing the type of name in Window struct from char[] to std::string.
What should I do if I don't want to simply change the type? Another possible fix I can think of is check if the int value of char is < 0 and then change the string.