I’ve problem with Editing EDIT window (both by writing or sending text to it).
Here’s my code.
Few days ago i had problem for which solution was deleting MSG handling loop from new windows.
Everything would be fine, but it caused another problem. I can’t edit EDIT windows.
When that handling loop is in new window Editing works, when not it doesn’t.
Parent window – MainWindow
Child windows – ChatWindow
There’s very few tutorials about Winapi, so sometimes i have to use code that i don’t fully understand(like 2 Wndproc methods to handle window action’s)
Thank’s for your time
OK here’s the problem, this
and this
In the
ChatWindowconstructor you store the this pointer (see the last parameter toCreateWindowEx). But when you save theChatWindowobject you save a copy in the okna vector. So the address of theChatWindowobject passed toCreateWindowExis not the same as the address of theChatWindowobject in your vector.Instead of
std::vector<ChatWindow> okna;you should have a vector of pointersstd::vector<ChatWindow*> okna;. That should fix the problem.The basic issue with your design is that your window objects are not copyable because you are telling Windows what the
thispointer is. You should add a private copy constructor and assignment operator to stop you copying them by mistake, like this.Oh, and I second what Jerry says, get a copy of Petzold.