Article View: comp.windows.ms.programmer
Article #204Re: Need help with static vars in multi-instanced code.
From: Peter Haller
Date: Tue, 07 Apr 1992 19:34
Date: Tue, 07 Apr 1992 19:34
27 lines
1990 bytes
1990 bytes
In a previous article, slahiri@magnus.acs.ohio-state.edu (Santanu Lahiri) says: >I am beginning a port of one application I wrote for DOS. It requires >me to run multiple instances of a code fragment within the program. >Specifically, a list box to select a file. Now, I have the basic file >selection window working just fine and dandy. Unfortunately, the listbox >approach I took requires declaring static handles for the listboxes within >the window procedure. (I create several listboxes on receiving the WM_CREATE >message) > >What happened was that I accidentally clicked on the FILE/OPEN menu item of >the parent window, and opened a second file selection window. The new window >came up, worked fine and exited. Unfortunately the first window was now dead. >I could work with the list boxes themselves, but the boxes would no longer >communicate with eachother. The reason? The handles had been whacked by >the second instance of the window. > Use a property entry to store the handles in. Property lists are ideal for temporary handle storage. Remember to release them when the window is closed. PCH -- Peter C. Haller | 'If you do what you Imagination Processing Systems | have always done, aa596@cleveland.Freenet.Edu | expect what you have "Are we having fun yet?" | always recieved.'
Technical Details
Message-ID:
<1992Apr7.193449.23212@usenet.ins.cwru.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!aa596References:
<1992Apr7.125032.5195@magnus.acs.ohio-state.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!aa596 From: aa596@cleveland.Freenet.Edu (Peter Haller) Subject: Re: Need help with static vars in multi-instanced code. Message-ID: <1992Apr7.193449.23212@usenet.ins.cwru.edu> Sender: news@usenet.ins.cwru.edu Nntp-Posting-Host: cwns6.ins.cwru.edu Reply-To: aa596@cleveland.Freenet.Edu (Peter Haller) Organization: Case Western Reserve University, Cleveland, OH (USA) References: <1992Apr7.125032.5195@magnus.acs.ohio-state.edu> Date: Tue, 7 Apr 92 19:34:49 GMT Lines: 28