mdh@beach.cis.ufl.edu (Mark Hampton) (01/13/89)
I am having a problem with EnumProps. In the MS Windows Programmer's Reference, section 2.2.17, it is implied that EnumProp may be used in conjunction with RemoveProps to remove all properties attached to a window. Well, when I run a program that does just that under the debugging version of windows (V2.03, Windows/386), and this is what I get: LocalFree: Freeing locked object 0000:0AE2 FatalExit code = 0x01F0 [this translates to LocalUnlock count underflow] Stack trace: KERNEL!IGROUP:REPLACEINST+057A KERNEL!IGROUP:LOCALFREE+006C USER!_TEXT:SHOWCURSOR+0175 5C01:2492 [this is the RemoveProps function, listed below] USER!_TEXT:ENUMPROPS etc. The RemoveProps function is simply: int FAR PASCAL RemoveProps (HWND hWnd, WORD wDummy, PSTR szProp, HANDLE hData) { RemoveProp (hWnd, szProp); return TRUE; } void DestroyWnd (HWND hWnd) { FARPROC lpfnEnumProc; HWND hActiveChild; hActiveChild = GetProp (hMainWnd, ACTIVE_WND); if(hActiveChild == hWnd) { SetProp (hMainWnd, ACTIVE_WND, NULL); } lpfnEnumProc = MakeProcInstance (RemoveProps, hMainInstance); EnumProps (hWnd, lpfnEnumProc); FreeProcInstance (lpfnEnumProc); } (and RemoveProps is listed in the exports part of the .DEF file.) DestroyWnd is called when a WM_DESTROY message is received by a window. It seems to me that EnumProps locks the memory used for the text of the string, and when it attempts to free it, bad things happen. I was wondering if anyone else has encountered this, and if there is a simple way (other than making a list of all properties and then freeing them when the EnumProp call is done). Thanks in advance. Mark Hampton -- ---------------------------------------------------------------------------- In Real Life: Mark Hampton | Internet: mdh@beach.cis.ufl.edu | UUCP: ...gatech!uflorida!beach.cis.ufl.edu!mdh ----------------------------------------------------------------------------