You must create some global access to the edit box, like with a global pointer which is uses in the callback.
When you have threading problems with it you may use the
WM_SETTEXT message
.
another way is with a
PostThreadMessage to call an message handler in the app. Than store the string in a global value.
Test your solution in different scenarios like Background or Lock Screen.