Article View: comp.windows.ms
Article #13443Problem with EnumProps + RemoveProps
From: Mark Hampton
Date: Thu, 12 Jan 1989 22:16
Date: Thu, 12 Jan 1989 22:16
56 lines
2472 bytes
2472 bytes
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
----------------------------------------------------------------------------
Technical Details
Message-ID:
<19629@uflorida.cis.ufl.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!xanth!ukma!uflorida!beach.cis.ufl.edu!mdhShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!xanth!ukma!uflorida!beach.cis.ufl.edu!mdh From: mdh@beach.cis.ufl.edu (Mark Hampton) Newsgroups: comp.windows.ms Subject: Problem with EnumProps + RemoveProps Message-ID: <19629@uflorida.cis.ufl.EDU> Date: 12 Jan 89 22:16:42 GMT Sender: news@uflorida.cis.ufl.EDU Reply-To: mdh@beach.cis.ufl.edu () Organization: UF CIS Department Lines: 56