Re: CWnd::GetDlgItem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jeff Partch (jeffp_at_mvps.org)
Date: 05/25/04


Date: Tue, 25 May 2004 17:15:58 -0500


"Spacen Jasset" <spacenjasset@yahoo.co.uk> wrote in message
news:c90f75$lml$1@news7.svr.pol.co.uk...
> It says in the docs that you shouldn't keep a copy of the pointer that
this
> method returns. Why is that since the windows API function GetDlgItem
> doesn't seem to say this.

Because the framework calls the API version to obtain the HWND, and then --
if it does not exist in the permanent handle map, it will instantiate a
CTempWnd and attach the HWND to it and add it to the temporary handle map.
Objects in the temporary handle map will be deleted at some point if and
when the framework gets around to it.

-- 
Jeff Partch [VC++ MVP]


Relevant Pages

  • Re: CWindow::Create Failure
    ... message via a message handler and map. ... window that needs to be displayed in this window. ... Instead, the HWND ...
    (microsoft.public.vc.language)
  • Re: message routing question
    ... mapping HWND to CWnd. ... One is permanent map and other is temporary map. ... > In the application framework message routing is based on the message map ... > static member array and a virtual function, ...
    (microsoft.public.vc.mfc)
  • Re: std::hash_map question (was re: replacing unsigned char * with CString)
    ... To see if a mapping exists for hwnd: ... does simply querying the map for an item cause a new entry in the map to be ... Note that the standard associative containers allow you to say the ...
    (microsoft.public.vc.mfc)
  • std::hash_map question (was re: replacing unsigned char * with CString)
    ... Having gotten used to the MFC collection classes, ... To see if a mapping exists for hwnd: ... BUT, this line will ADD AN ELEMENT mapping hwnd to NULL, if hwnd ... does simply querying the map for an item cause a new entry in the map to be ...
    (microsoft.public.vc.mfc)
  • Re: What bothers me...
    ... I think you can declare any managed type by using the framework ... designation even when they don't map to a specific VB datatype. ...
    (borland.public.delphi.non-technical)