How to arrange work Between WndProc & New Thread
Hi My Best Friends,
I have very simple question :
Given :
- To Build a Window and add bottuns on this window , Say Window 1
- From This Window ,Build Child Window Say Window 2
Required :
To use window 1 to add all Buttons on the Graphical User Interface
To Use Window 2 (Child window ) : to add OpenGL Device
Problem 1 :
when I move the Window 1 , or I resize window 1 I lost all the graphics from OpenGL , Because WndProc send a Paint message and redraw on window 2
Solution 1 :
I understand that , I can create a new thread , and Let the OpenGL Device working under New thread...
Problem 2 :
Still I do not know how can I Prevent sending message from New thread to WndProc ... I need to prevent any message go from wndProc to Window 2 (OpenGL Window)..
I am looking forwared to receive a well good explanation from my best collegue
Mr. Igor Vartinove and Mr. VictorN.. and form my other best collegues..
My Kind Regards
Re: How to arrange work Between WndProc & New Thread
Re: How to arrange work Between WndProc & New Thread
Quote:
Originally Posted by
mecheil.edwar
Problem 1 :
when I move the Window 1 , or I resize window 1 I lost all the graphics from OpenGL , Because WndProc send a Paint message and redraw on window 2
...
Still I do not know how can I Prevent sending message from New thread to WndProc ... I need to prevent any message go from wndProc to Window 2 (OpenGL Window)..
Instead of trying to prevent the message loop from sending messages to your window, you should just repaint it when it gets the WM_PAINT message.
Re: How to arrange work Between WndProc & New Thread
Quote:
Originally Posted by
D_Drmmr
Instead of trying to prevent the message loop from sending messages to your window, you should just repaint it when it gets the WM_PAINT message.
Thanks D_Drmmr for your reply..
But the Problem if I let GDI paint the window , I will lose the the Painting object from OpeGL Device...
So I need to stop painting from GDI on the child Window (Window 2) .. to give a chance to see what is painted by OpenGL device
Re: How to arrange work Between WndProc & New Thread
Quote:
Originally Posted by
mecheil.edwar
So I need to stop painting from GDI on the child Window (Window 2) .. to give a chance to see what is painted by OpenGL device
I don't understand. GDI does not paint anything unless you tell it to.
Please show your code to handle WM_PAINT for the parent and child window.
Re: How to arrange work Between WndProc & New Thread
Quote:
Originally Posted by
D_Drmmr
I don't understand. GDI does not paint anything unless you tell it to.
emmm this isn't right. because it will.
it's the other way around.
GDI will come ask you (or your program rather) via a WM_PAINT if any portion of the program needs repainting.
this can happen as a result of your own program explicitely telling GDI that a portion of the window is no longer up to date (InvalidateRect)
or if some other window was on top of your program obscuring part of your program's window and that other program has now been moved/minimized/closed so that some part of that previously obscured part is now visible.