문제

According to this thread: Can the HWND from CreateWindow/CreateDialog be GetMessage'd from another thread?, it seems that I can't use GetMessage in another thread using the main thread's HWND.

I'm simply trying to grab the value inside an edittext using GetMessage which is called from a new thread. What are some ways I can do this?

도움이 되었습니까?

해결책

If you want to get the value from an edit control you don't actually use GetMessage at all. GetMessage is for receiving messages, but to get the text from a window you have to send it a message - i.e. you use SendMessage.

The message to send is WM_GETTEXT (preceeded by WM_GETTEXTLENGTH). Or even easier, use one of the wrapper functions the OS provides for you - in this instance GetWindowText or GetDlgItemText. They work across thread boundaries just fine (and in fact even across process boundaries).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top