Fixing app for windows and compilation in CodeBlocks

Codeblocks was giving some writing policy errors, so I had to move some variables definitions upper (maybe ther is an option to avoid such type of errors).

Also on my machine WM_GETTEXT was giving some times some trash instead of text input value. Maybe it was because of asking for too much (EM_GETLIMITTEXT was returning 30k).
So I used trick from [MSDN WM_GETTEXT coments](http://msdn.microsoft.com/en-us/library/windows/desktop/ms632627(v=vs.85).aspx).

Before merging, just check if it working on your environment as it is totally different from mine.