You can set the text in any function you want, but you must distinguish between the pure SetWindowText and member value of an "connected" variable. Here is some
example.
Important is that your calls are in the main-thread. If not use a PostThreadMessage with a handler.