AW: WM_GETDLGCODE infinite message loop
Graham -- Cunningham@tgd.swissptt.ch Monday, April 22, 1996 [Mini-digest: 2 responses] This was on the list a while ago heres the answer -- snatched from usenet. > Unpublished article from Microsoft: > --------------------------------------------------------------------- >=20 > Subject: > Date: > Fri, 1 Mar 96 09:11:28 TZ > From: > Sergey Zarembsky (Stream)> To: > mplante@versus.com >=20 > .TITLE: Child CPropertySheet Hangs If Focus Is Switched > .VERSION(S): 4.00 > .OPERATING SYSTEM(S):WINDOWS NT >=20 > -----------------------------------------------------------------------= > The information in this article applies to: >=20 > - The Microsoft Foundation Classes (MFC), included with: > Microsoft Visual C++, 32-bit Edition, version 4.0 > -----------------------------------------------------------------------= >=20 > SYMPTOMS > =3D=3D=3D=3D=3D=3D=3D=3D >=20 > If a CPropertySheet is a child of a CDialog or another CPropertySheet, > and focus is placed in a control inside the child CPropertySheet, when > you switch focus to another window, the program will hang. The program > will also hang if focus is on a control and you close the sheet. The > child CPropertySheet continually gets a WM_GETDLGCODE. >=20 > CAUSE > =3D=3D=3D=3D=3D >=20 > By default, CPropertyPages will have a style of WS_EX_CONTROLPARENT. > CPropertySheets will not have this style. This style allows a user to > tab from a control inside the page to one in the sheet. >=20 > When focus is switched from the parent sheet, code which handles > default push buttons loops through all the controls in the pages and > the sheet. Cycling through controls is done using GetNextDlgTabItem().= > The loop cycles through controls in the page in the child > CPropertySheet and finds its way to controls in the parent page or > parent dialog. At this point, GetNextTabItem() is not able to find > controls inside the child CPropertySheet since it doesn't have a style > of WS_EX_CONTROLPARENT. The loop never ends because it never finds the= > original control that had focus. >=20 > RESOLUTION > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Override OnInitDialog() for the child CPropertySheet and add the > WS_EX_CONTROLPARENT style. >=20 > STATUS > =3D=3D=3D=3D=3D=3D >=20 > Microsoft has confirmed this to be a bug in the Microsoft products > listed at the beginning of this article. We are researching this bug > and will post new information here in the Microsoft Knowledge Base as > it becomes available. >=20 > MORE INFORMATION > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > REFERENCES > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Sample Code > ----------- >=20 > // CMySheet is derived from CPropertySheet > BOOL CMySheet::OnInitDialog() > { > ModifyStyleEx (0, WS_EX_CONTROLPARENT); >=20 > return CPropertySheet::OnInitDialog(); > } >=20 > /* Compile options needed: default >=20 > This article might help you! Graham Cunningham=20 email : Cunningham@tgd.swissptt.ch phone : 00 41 31 338 0633 -----From: Ghislain Lachapelle >OS = Windows NT 3.51 >VC++ 4.1 >Dell Dimension XPS P90 >32 MB Ram > I have NT 3.51, VC++ 4.1, Alr Evolution X P90 and 32 MB RAM. What a coincidence? I built a prototype yesterday afternoon which seems exactly what you did and got very similar results. >I have a modeless Prop sheet. In one page of the sheet, I create another >modeless Prop sheet. When I first select the page, which then loads the >nested >Prop sheet all is well. If I then select a second page from the nested >property sheet, >then select the first page on the parent prop sheet, I enter an infinite >loop. It appears >that the child prop sheet is sending a WM_GETDLGCODE message to itself >repeatedly. > I break in the code during the infinite loop and had your WM_GETDLGCODE message. I also found another message which is WM_NOTIFY with a PSN_SETACTIVE parameter. I tried to add the style NO PARENT NOTIFY to the property page but the MFC CPropertyPage code asserts on any extended style. I do not have any workaround for now and think a derivation of OnNotity function is a good start to search. N.B.: I put breakpoint in all OnSetActive functions (in all property page) and did not encountered the infinite loop. Perhaps this will help you. //////////////////////////////////////////////////// Ghislain Lachapelle(Ghislain.Lachapelle@matrox.com) Ghislain Lachapelle Matrox Electronic Systems Ltd. Imaging Group 1055 St-Regis Blvd. Dorval, Quebec, Canada H9P 2T4 (514) 685-7230, ext. 2495 //////////////////////////////////////////////////// . . . . . -)------+====+ . -)----==== ,' ,' . . . `. `.,;___,' . `, |____l_\ _,.....------c==]""______ |,,,,,,.....____ _ . . "-:______________ |____l_|]''''''''''' . . ,'"",'. `. . -)-----==== `. `. LS . -)-------+====+ . . . .
David W. Gillett -- DGILLETT@expertedge.com Wednesday, April 24, 1996 > > Unpublished article from Microsoft: ... > > Override OnInitDialog() for the child CPropertySheet and add the > > WS_EX_CONTROLPARENT style. Note that you must derive your own class from CPropertySheet and add this there. If you try to pass this as a style to CPropertySheet::Create(), you will find another way into the WM_GETDLGCODE infinite loop.... Dave
| Вернуться в корень Архива |