Cc TAB phm, phm m?i tn v h?a phm khng ho?t ?ng nh mong ?i khi i?u khi?n ActiveX l c?a s? ph? huynh c?a m?t h?p tho?i modeless ho?c c?a m?t c?a s? propertysheet

D?ch tiu ? D?ch tiu ?
ID c?a bi: 187988 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TRI?U CH?NG

Khi i?u khi?n ActiveX l c?a s? cha c?a m?t modeless c?a s? h?p tho?i h?p ho?c propertysheet, cc TAB phm, phm m?i tn, v gia t?c phm khng lm vi?c nh mong ?i. Phm TAB khng di chuy?n tiu i?m ?u vo t? m?t trong nh?ng ki?m sot khc. Nh?n cc phm m?i tn ho?c h?a phm trong modeless c?a s? h?p tho?i h?p ho?c propertysheet khng c hi?u l?c.

NGUYN NHN

V?n ? l i?u khi?n ActiveX khng s? h?u th bm. Cc my bm thng i?p ?c s? h?u b?i ?ng d?ng container. V? v?y, t?t c? cc phm t?t th k? b?ng vi?c p d?ng thng ch?a v khng phi ?n h?p tho?i modeless h?p ho?c propertysheet c?a s?.

Cc v?n ? khng x?y ra v?i m?t h?p tho?i phng th?c h?p/propertysheet c?a s? v? cc tin nh?n bm thu?c s? h?u c?a ng?i qu?n l? h?p tho?i, v n s? chm sc c?a x? l? t?t c? cc phm t?t th.

GI?I PHP

Ci ?t m?t mc Windows WH_GETMESSAGE cho modeless h?p tho?i h?p/propertysheet b?t ngu?n l?p ? cho php n ? nh ch?n t? h?p phm v x? l? my gia t?c.

T?NH TR?NG

Hnh vi ny l do thi?t k?.

THNG TIN THM

M?u sau y cho th?y m?t cch ? ci ?t cc c?a s? tin nh?n mc ? m?t l?p h?c c ngu?n g?c CPropertySheet modeless:

M?u m?

   // Handle to the Windows Message hook. It can be a global variable or a
   // member variable in your CPropertySheet-derived class.
   HHOOK hHook = NULL;



   // Hook procedure for WH_GETMESSAGE hook type.
   LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
   {
      // Switch the module state for the correct handle to be used.
      AFX_MANAGE_STATE(AfxGetStaticModuleState( ));



      // If this is a keystrokes message, translate it in controls'
      // PreTranslateMessage().
      LPMSG lpMsg = (LPMSG) lParam;
      if( (nCode >= 0) &&
         PM_REMOVE == wParam &&
         (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) &&
         AfxGetApp()->PreTranslateMessage((LPMSG)lParam) )
         {
         // The value returned from this hookproc is ignored, and it cannot
         // be used to tell Windows the message has been handled. To avoid
         // further processing, convert the message to WM_NULL before
         // returning.
         lpMsg->message = WM_NULL;
         lpMsg->lParam = 0L;
         lpMsg->wParam = 0;
         }



      // Passes the hook information to the next hook procedure in
      // the current hook chain.
      return ::CallNextHookEx(hHook, nCode, wParam, lParam);
   }



   // Declare and define the following two functions:
   BOOL CModelessPropertySheet::OnInitDialog()
   {
      CPropertySheet::OnInitDialog();

      // Install the WH_GETMESSAGE hook function.
      hHook = ::SetWindowsHookEx(
         WH_GETMESSAGE,
         GetMessageProc,
         AfxGetInstanceHandle(),
         GetCurrentThreadId());
      ASSERT (hHook);



      return TRUE;   // Return TRUE unless you set the focus to a control.
                     // EXCEPTION: OCX Property Pages should return FALSE.


   }



   void CModelessPropertySheet::OnClose()
   {
      // Uninstall the WH_GETMESSAGE hook function.
      VERIFY (::UnhookWindowsHookEx (hHook));



      CPropertySheet::OnClose();

   }
				

Cc b?c ? t?o l?i v?n ?

  1. Ch?n MFC ActiveX ControlWizard ? t?o ra m?t ActiveX ki?m sot. Ch?p nh?n t?t c? cc thi?t l?p m?c ?nh.
  2. Hi?n th? m?t h?p tho?i modeless h?p ho?c propertysheet c?a s? khi b?m-p vo bn trong s? ki?m sot.
K?T QU?: Khi h?p tho?i modeless h?p ho?c propertysheet c?a s? s? ?c hi?n th?, nh?n phm TAB ho?c h?a phm khng c hi?u l?c.

THAM KH?O

(c) t?p on Microsoft 1998, t?t c? cc quy?n. Nh?ng ng gp c?a Yeong-cho Tam, Microsoft Corporation.

Thu?c tnh

ID c?a bi: 187988 - L?n xem xt sau cng: 20 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Foundation Class Library 4.2, khi ?c dng v?i:
    • Microsoft Visual C++ 4.2 Enterprise Edition
    • Microsoft Visual C++ 5.0 Enterprise Edition
    • Microsoft Visual C++ 5.0 Professional Edition
    • Microsoft Visual C++ .NET 2002 Standard Edition
    • Microsoft Visual C++ .NET 2003 Standard Edition
T? kha:
kbcode kbctrlcreate kbdlg kbprb kbmt KB187988 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:187988

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com