0

I'm writing my first Direct show filter, and everything works fine except when I try to create the custom properties page for the filter.

I would like to create one checkbox control foreach output pin available in the filter.

HRESULT CActivateDeliveryProp::OnActivate(void)
{

  ... 

  CWnd * pMyWindow;
  pMyWindow = CWnd::FromHandle(this->m_hwnd); // or may (this->m_Dlg); ??

   ...

  CButton *chkOutputPin;
  chkOutputPin = new CButton;
  chkOutputPin->Create(_T("&my check")
     , WS_CHILD | WS_VISIBLE |   BS_AUTOCHECKBOX
     , CRect(10, iTopPosition, 140, 35),pMyWindow, 0x11);

}
  • Is this the correct way to get the handle to the parent dialog?

Update:

Sorry, I didn't express my real problem well, I only wrote a part of my problem. I don't have problem getting main parent form. My problem is when I try to add a new CheckBox control I get this assertion and code doesn't work. Assertion

Thanks for all!

tur
  • 33
  • 3
  • DirectShow DLLs are typically non-MFC projects, where `CWnd::FromHandle` is not applicable. It does not mean you cannot use MFC there, it is not just as easy as simply to start using MFC classes. You typically use plain Win API. – Roman R. Sep 30 '15 at 15:56
  • I'm using MFC libraries. I think I don't have problem with it – tur Oct 01 '15 at 06:18
  • Well, you should have no problem accessing `CBasePropertyPage::m_hwnd` then, just as you shown in your question. `m_Dlg` is a copy of the handle and is never used across BaseClasses. – Roman R. Oct 01 '15 at 07:03
  • Ok, and how can I add control to my CWnd object? (Sorry I'm newbie in this :S) – tur Oct 01 '15 at 09:27
  • Hit the second button and check position in MFC source. It's apparently MFC related problem of doing stuff in a non-MFC window. You said you don't have problems with MFC library. Apparently you do. – Roman R. Oct 01 '15 at 09:50

0 Answers0