• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

HwndSource not rendering when come into view



Hi there,

I got a short question on interop with MFC. In an complex MFC-app I
have a CStatic-object as the placeholder for the WPF-Contol. I use a
HwndSource-object to wrap the WPF-stuff inside it. The size of the
CStatic should also be the size of the HwndSource's HWND which I
retrieve through:
myHwnd = (HWND)hwndSource->Handle.ToPointer();

Now, I start the appication but the control doesn't show up. It only
appears if I resize the app cause the CStatic reacts to WM_SIZE message.
In the message handler OnSize(..) I do SetWindowPos(...) on the
myHwnd-object and voila, the WPF-Control is visible.

I checked that the HwndSourceParameters-object is initialized correctly.
I also checked that the dimensions of the hwnd is valid ats startup and
during runtime. I also tried to force redraw on the myHwnd-object but
without success.

Any ideas why the window is not painting itsself at startup and only
appears after resize (SetWindowPos(..))?

Chris :-)

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)