We run into a problem with temporary handles.
As I read here: What is the lifetime of a CWnd obtained from CWnd::FromHandle?
CWnd::FromHandle()
will create a temporary handle. Our plan was to store the handle for later use, but this won't work.
We also tried CWnd::FromHandlePermanent()
but this somehow returns a null pointer .
And also mpWnd->Attach(mhWnd);
threw an Access violation exception.
If possible we would like to store the CWnd
rather than the HWnd
and call FromHandle()
everytime the CWnd
is required.
Does anybody know a solution for this?