Home > Software engineering >  The UI thread to create dialog design child window and parent window of communication problems
The UI thread to create dialog design child window and parent window of communication problems

Time:09-26

I created a dialog in the UI thread way, I think in this dialog in the main window of variable real-time changes, I think of the getparent () function, but the getparent () function returns to is null, so is there any other way to get to the main window of a variable's value?

CodePudding user response:

Multiple Threads in the User Interface of http://msdn.microsoft.com/zh-cn/library/ms810439.aspx

CodePudding user response:


Many solutions, such as the parent window of the UI put global variable timer timer, let the child window reading,
Send a message to the parent window or child window, the message each other, WM_USER + 1,
The child thread operation is the main thread of the UI error prone, and is not allowed

CodePudding user response:

"But getparent () function returns the empty value"
The child window is not without parent window?
FindWindow looking for the main window.

CodePudding user response:

I don't really understand this, and asked

CodePudding user response:

Child window is the main window of the child?

CodePudding user response:

In the progress of the child window, to get the main window class pointer

CodePudding user response:

When you create a thread, the HWND of the dialog box window handle as thread parameters can be passed to the thread,

CodePudding user response:

Handle to the window structure into a thread parameters or use global variables
  • Related