Subclassed CEdit needs OnClose

I have a subclassed CEdit control.  I need to GetWindowText() just
before the CEdit is destroyed, but can't figure out where to do this. 
I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd
is no longer valid), OnClose() (doesn't get called), etc.

Thanks,


Steve
0
junk (27)
9/25/2003 8:21:10 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
526 Views

Similar Articles

[PageSpeed] 32

Could you grab the text in a OnKillFocus() handler?  That way you'd get a
message when they move off of the control as well as when it is destroyed.
Just a thought.

Tom

"Steve" <junk@bruff.com> wrote in message
news:97327c0.0309251221.35c93d02@posting.google.com...
> I have a subclassed CEdit control.  I need to GetWindowText() just
> before the CEdit is destroyed, but can't figure out where to do this.
> I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd
> is no longer valid), OnClose() (doesn't get called), etc.
>
> Thanks,
>
>
> Steve


0
tserface (3860)
9/25/2003 8:39:40 PM
You'll probably find a better solution but here's a hack:

inside your edit class add a member:  Cstring m_theText;

udpate m_theText with every change to the contents.

this will then persist even after window is destroyed.

probably not effecient but if you don't expect giant strings I don't think
anyone would notice.


"Steve" <junk@bruff.com> wrote in message
news:97327c0.0309251221.35c93d02@posting.google.com...
> I have a subclassed CEdit control.  I need to GetWindowText() just
> before the CEdit is destroyed, but can't figure out where to do this.
> I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd
> is no longer valid), OnClose() (doesn't get called), etc.
>
> Thanks,
>
>
> Steve



0
river.ross (102)
9/25/2003 8:42:25 PM
"Steve" <junk@bruff.com> wrote in message
news:97327c0.0309251221.35c93d02@posting.google.com...
> I have a subclassed CEdit control.  I need to GetWindowText() just
> before the CEdit is destroyed, but can't figure out where to do this.
> I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd
> is no longer valid), OnClose() (doesn't get called), etc.

Steve,

In addition to your other replies, I'm a bit concerned about why you're not
getting the WM_DESTROY notification. Don't hate me for asking, but did you
(or the wizard) add the ON_WM_DESTROY macro to your subclass message-map?

Jeff...


0
jeffp (1712)
9/26/2003 2:25:58 AM
"Steve" <junk@bruff.com> schrieb im Newsbeitrag
news:97327c0.0309251221.35c93d02@posting.google.com...
> I have a subclassed CEdit control.  I need to GetWindowText() just
> before the CEdit is destroyed, but can't figure out where to do this.
> I've tried OnDestroy() (doesn't get called), my destructor (the m_hWnd
> is no longer valid), OnClose() (doesn't get called), etc.

I'm wondering that OnDestroy() isn't called. In my subclassed CEdit it
definately gets called and the window text is still valid at that time.

Hans


0
9/26/2003 2:54:31 AM
Reply:

Similar Artilces:

Subclassing
Hello, Im very new to c++ programming so pardon me if this is a dumb question and my bad english. I made a subclass from CListBox. I want to handle all the list controls derived from this class on one function, for example, void CListBox_SC::OnRButtonUp(UINT nFlags, CPoint point) { ..... } on this function I want to manage the OnRButtonUp event, and with a switch or if statement, select the code to execute. The following does work: SetCurSel(ItemFromPoint(point, ifp)); but the following comparison is never true, (IDC_LST_TIPO is a resource for one of the ListBoxes) UINT currLst = It...

Custom Drawing CEdit : Subclassing
Hello experts, My objective is simple, but I'm not entirely sure what needs tweaking. I am using MSVC 6, and I would like to subclass the CEdit box so that it appears as the color-picker editbox of a PropertyGrid. There is a color box followed by three values. Like this: [###] 255; 192; 192 Where ### is just a color box representation of the value. So thus far, I've made a masked CEdit box, where I can edit the numbers (or click a button that visually sets the numbers from a different window), and I'm happy with that - but what I would like to do next is to subclass the dra...

Need help with the Query.
How can I get desire results below. I cannot seem to figure this out. Any help is greatly appreciate. -- Please ignore previous posted. IF OBJECT_ID('Tempdb.dbo.#Temp', 'u') IS NOT NULL DROP TABLE #Temp GO CREATE TABLE #Temp ( UserHistoryId INT NULL, UserId VARCHAR(6) NULL, EventDate DATETIME NULL ) GO INSERT INTO dbo.#Temp([UserHistoryID],[UserId],[EventDate])VALUES (664, 'User1', CONVERT(DATETIME, 0x00008eac00000000)) INSERT INTO dbo.#Temp([UserHistoryID],[UserId],[EventDate])VALUES (1014, 'User1', CO...

How to change the color of a CEdit Control ??
Merry christmass Progeammers, I'm new to MFC programming, and would like to know how to change the CEdit control color aswell other controls colors. thanks in advance Hello To change the color of edit control you need to handle the WM_CTLCOLOR or WM_CTLCOLORSTATIC message depending on the control is read only or not. Then, in the message, return the appropriate color brush handle you want to change. For Ex HBRUSH myframe:: OnCtlColor(CDC *dc,CWnd *wnd,UINT color) { HBRUSH hbr=CWnd::OnCtlColor(dc,wnd,color); if(wnd->GetDlgCtrlID()==ID) /*give here the id of control */ ...

Need Error Number
Hi everyone! Using A02 on XP. Need to know what the error number is for this message: "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the indes, or redefine the index to permit duplicat entries and try again." I need to show a specific message instead of that one. Is there a directory for errors? How do I find a list? Thanks in advance for any help or advice! -- Bonnie W. Anderson Cincinnati, OH ...

Need to recalculate populate 1099 summary
How can I repopulate/recalculate 1099 summary (PM00202) without editing each vendor summary? We have a number of vendor with the wrong 1099 setup that needs to be updated. Thanks in advance for your help. ...

Distribution list help needed
We created a distribution list. Internal active directory users are able to send to the list. Internet e-mail senders are not able to send to the list. The mail is not bouncing back to the Internet e-mail users. The messages are just not getting to the inbox of the members of the distribution list. For example our domain is abc.net. The list we created is questions@abc.net. We have four users in the list. When a user logged into our Active Directory sends a mail to questions@abc.net the mail is successfully sent to the inboxes of all of the users in the list. When the e-mail ...

New Report Needed
Hi - We need to generate a report that, as an input, will take the ItemLookupCode and return the customer's name and other info (e.g. phone number, cust no) for everyone that has bought one or more of those items. All suggestions greatly appreciated. I can program in FoxPro and Access, and have already created an Access project that allows me to view and report on all the data. Just not sure where to go from here. Bud Izen Salem Oregon There's an edited Detailed Sales report that includes Customer Contact information available on the Reports Library in Customer Source. Just...

Combo show the item wrong, I need the source code user32.dll library
Hi.. I have a combo and I use the CComboBox, CListBox and CEdit classes, when the list box of a combo box is visible and I can write the characters using keyboard one by one until the acction had finished, I must see the new item in my combo but it not happens. I only see the previous value I had analized all messages of my combo in WindowProc and I had looked that when Window is in the 0x164 message (I don't know what is the purpose or meaning, but in this case the index value is correct) and later WM_LBUTTONUP message (there are continuos) the index value of my new item change to zero ...

need some help please, read inside, cheers!!
Hello Peeps! I am trying to work out a formula that can count multiple strings i.e. =COUNTIF($E$3:$E$40,"Setup") But not only have it count look for the word setup, have it look for another word to i.e!!! =COUNTIF($E$3:$E$40,"Setup", "Done") This doesn't work but u get the jist of what i need, any help would be much appreciated!!me! Thanks Alot Kami Wilson Use separate countifs: =COUNTIF($E$3:$E$40,"Setup") + COUNTIF($E$3:$E$40,"Done") Andy. "Wilson" <Lordwils@btopenworld.com> wrote in message news:78na00ppvvbsqt...

Mailbox needs reducing
We have this mailbox that has been left for months and with no limits, it's now 11GB!! Ho can I trim in down, I don't really want to go into the mailbox and do it, can Exchange do it? In news:euNRN1iPHHA.404@TK2MSFTNGP02.phx.gbl, Gonzo <no@no.com> typed: > We have this mailbox that has been left for months and with no > limits, it's now 11GB!! > > Ho can I trim in down, I don't really want to go into the mailbox and > do it, can Exchange do it? Presuming you're not on 5x or earlier, you can use mailbox management policies to get rid of items ol...

Need help opening an Access DB using CDaoDatabase
When trying to open an existing Access DB (.mdb) I get the following exception: "Unrecognized database format 'C:\path...\database.mdb' I am trying to use CDaoDatabase as follows: CDaoDatabase m_accessDb; m_accessDb.Open("C:\\path...\\database.mdb"); Invoking the Open member function throws the DAO exception. Thanks in advance, Jim "Jim Fleming" <jimfleming@charter.net> wrote in message news:10n5t7cri98137a@corp.supernews.com... > When trying to open an existing Access DB (.mdb) I get the following > exception: > > "Unrecognized d...

Help with subclassing a RichEditCtrl
Hi folks, I could use some help. As a side project I am trying to write a DLL that will extend the functionality of an existing application that I do not have source code for, i.e., some autocompletion functionality, word lookup, etc. In the actual DLL, I am going to have to inject it into the existing app and then use FindWindow or something like that to subclass the existing RichEditCtrl. I need to be able to process the WM_CHAR and WM_KEYDOWN messages only. I started out by creating my own sample project using a RichEditCtrl in my project to code my object. I've now moved everythin...

need a rule to filter attechment of 1byte
hola: my problem is easy, a need to create a rule to filter all emails that comes w/ attachment of 1kb. Easy Any help thanks ivan ...

Help needed on
Here is my problem: 1) I have two tables Table1 and Table2 where Table1 contains a Text field of references to Primary Keys in Table2 in the form "5,6,8,9" 2) I have created a new table, Table3 to store this information properly as columns "Table1ID" and "Table2ID" How do I actually go about getting the Text string out of Table1 and into Table3 as N number of records? Dim dbCurr As DAO.Database Dim rsCurr As DAO.Recordset Dim lngLoop As Long Dim strSQL As String Dim strKeys As String Dim varKeys As Variant Set dbCurr = CurrentDb() Set rsCurr = dbCurr...

Please help i need advice on forwarding messages
Hi i have exchange 2003 on a small business server What is the best way to forward emails from a user on the exchange server to another smtp mail server on the same subnet? It is an old Vpop3 mail server that is collecting data for an old application that does not yet have exchange capabilities. do i need a local dns entry, how can i tell the exchange server where this old server is? Thanks Paul Paul wrote: > Hi i have exchange 2003 on a small business server > What is the best way to forward emails from a user on the exchange server to > another smtp mail server on the same s...

WM_CREATE for a subclass
Hi All, I am fairly new to C++, although I have developed OO windows applications in the past using CTD and Power Builder. I am developeing an edit class based on a CEdit. I am trying to trap the WM_CREATE message to modify the style of the window (i.e. to make is multiline). For some reason the control does not appear to be getting the WM_CREATE message ( or at least it is not implementing the handler I have for it). At present I create an edit control on a form and the Subclass the edit. This appears to work as my user defined menu is used and my color modifications appear as requir...

Subclassing CWinThread
I created a subclass of CWinThread - no big deal! Now, what I would like to do is use that subclass as a base class for a couple of other, more specialized classes. How can I do this? If I create a subclass as a generic C++ class, then I'm running into the assertion, "Invalid Address specified to RtlValidateHeap( 00940000, 0042DBA0 )" when I post the quit message to the thread. I assume this might have something to do with the virtual/non-virtual constructor combination of the MFC class and the generic C++ class. Any thoughts? Create more subclasses of CWinThread, then ...

Need a web browser
I'm developing a pc C++ app using VS 2008. The app needs to seamlessly allow the user to render pages from the apps website. In the past this was done using HtmlHelp. However, we need to expand the interface so the app can include input values without user involvement. I don't see how you could do this thru the HtmlHelp interface (Or is there a way??). So I seems that the best solution is to start Internet Explorer and pass the URL with the values (how would you do this?). IE is an app prerequisite. Any ideas on whats available to solve this problem thats already established??...

Newbie needs advice
I recently bought a new computer and it came with Money so I installed it for kicks. I have set up checking, savings, and credit card accounts. I have a basic question though. I pay off my entire credit card bill every month. I want to be able to track all of my credit card and checking account purchases so I can see where the money is going. What is the best way to go about this? I assume the best way is to download my credit card and checking account data and assign spending categories to each purchase. But how do I reconcile the payments that I see on both my checking account statement and ...

Need macro that performs same action top to bottom.
How can I write a macro that performs the same action on every row from top to bottom once I start it. More info please, unless of course you want to perform the action on all 65536 rows! TGHCOG -- Message posted from http://www.ExcelForum.com I have a sheet with 810 rows and I need to insert a blank row between each. I know how to write a macro that will insert a blank row, but it only works one at a time. I'd like to start at the top and have it insert a blank between the first two and then drop down and repeat itself over and over untiul it gets to the bottom of the sheet. ...

Outlook 2003 need other spam software??
I'm getting a new computer with Outlook 2003. I currently have Outlook XP using "I Hate Spam" for getting rid of spam. Will I need to use "I Hate Spam" with Outlook 2003, or does the new junk mail filter do a good job filtering out the spam. Thanks. it does good, but you may want to continue using I hate Spam. The best thing to do is try it with just Outlook's filter set on high, and use I hate spam if the results are not as good as you are used to. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for W...

Subclassing TreeView
I created a class derived from a TreeView (ShellTree) that displays the Shell directory structure . I changed the LeftView class so that it is derived from my ShellTree class, and everything works as expected, except I cannot add any TreeView specific message handlers to my LeftView class any more eg. NM_DBLCLICK. Basically in a nutshell what i want to do is display the directory name (which is stored in a variable in the ShellTree class) when the LeftView is Double clicked Check out http://www.codeproject.com/treectrl/enumdeskclones.asp Which isn't perfect.. but is a good star...

Subclassing a subclass of CDialog, for cross-platform compilation
Hi people, I've been working on porting an app from PC to Mac. What I'm trying to do, is separate out the PC specific components into it's own subclass. So there are the PC specific functions like PCAppDlg::OnBtnClicked1, and mac specific functions like MacAppDlg::BlaBlaBla. Of course the Mac subclass doesn't compile on the PC, and the same the other way around. I've had to write my own CDialog wrapper for Mac but that's another story. Now anyhow, this leads me to a question. How to subclass a subclass? Specifically, how does the message maps work? Will there be any p...

Xml Serializing subclass problem
Hi guys. I've come across a problem when I tried to serialize a class into xml, only to discover that the parent class's XML Serialization properties weren't included in the output xml. Actually, the class I'm serializing is two steps down in the inheritance ladder. It's got a parent class which also has a parent class :( All those classes in the hierarchy are Xml Serializable, and I'd think that it should be obvious that all attributes/properties of the parents should be serialized for any given subclass, no ? Here's the two classes, subclass first, parent class...