|
Don't the CWnd destrcutors call destroywindow() automatically...??
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Not according to MSDN, DestroyWindow destroys the window the CWnd encapsulates, but not the CWnd itself.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian Graus wrote:
Not according to MSDN, DestroyWindow destroys the window the CWnd encapsulates, but not the CWnd itself.
In his case, when his parent window is destroyed all the child windows are destroyed too. And he calls delete to delete the CWnd object in the destructor. So things should be okay.
Nish
My most recent CP article :-
A newbie's elementary guide to spawning processes
www.busterboy.org
|
|
|
|
|
|
HockeyDude wrote:
when delete is called on the controls pointer do all the CWnd destructors get called automatically...???
Yes they will be called but IMO before that you will have to remove the windows from screen.
From MSDN:
"In the MFC framework, when the user closes the frame window, the window’s defaultOnClose handler callsDestroyWindow."
HockeyDude wrote:
Would I have to call the controls destroyWindow functions..??
From MSDN:
"Do not use the C++ delete operator to destroy a frame window or view. Instead, call the CWnd member function DestroyWindow. Frame windows, therefore, should be allocated on the heap with operator new."
Atul
|
|
|
|
|
|
Yes Nish you are correct I was talking about CButton.
I was positive that destructors were called with delete, but you and christian have helped me verify with myself.
Although what Christian said about DestroyWindow not being called kinda has me worried, i'd hate to have a bunch of HWND's lingering around after there CWnd is bye bye.
Ahh..to hell with it...i'm take the leakage if there is any...
Thanx !
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
|
All I needed to hear...
Thanx Nish!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Oops a daisy!...you are right...
Sorry...must have been daydreaming...
Atul
sleep...sleep...sleep...
|
|
|
|
|
I set my pointer to a window by doing
CWnd * Handle=FindWindow("AIM_IMessage",NULL);
and now i want to do a
SetWindowText("Some text") ;
or a
::SendMessage(HWND Hand...);
Only thing is, I don't know how to specify that I want my pointer to be where it sends the text... Or for that matter send it to a child window of the window that the pointer is pointing to...
Either way
Can anyone help me out?
|
|
|
|
|
Hi,
I'm not quite sure what you're asking, but if your CWnd * is valid (ie it's not NULL), then you can either do:
CWnd *pMyWindow = FindWindow("AIM_IMessage", NULL);
pMyWindow->SetWindowText("Some Text");
or
pMyWindow->SendMessage(params)
By the way, if you need a HWND for the window you've got a pointer to, just call:
pMyWindow->GetSafeHwnd();
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
|
Hi, I have a dialog with a couple of textboxes on it, and I want to change
the font size on one of the terxtboxes. I can't seem to find out how. Any
input would be great. Thanks
|
|
|
|
|
Have you tried SetFont?
void CMyDialogClass::SetTheFonts()
{
m_fntBigFont.CreatePointFont(24, _T("Arial"));
m_fntLittleFont.CreatePointFont(6, _T("Arial"));
m_edtBigEditControl.SetFont(&m_fntBigFont);
m_edtLittleEditControl.SetFont(&m_fntLittleFont);
}
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
|
|
I have created a mfc project and within this I have created a dialoguebar and multiple document view windows. When I click on a button on my dialoguebar how can I get the current document object as it has a Carray object which I would like to obtain.
Thank you in advance.
|
|
|
|
|
That depends on where you are handling the button click. If the dialog bar is part of the main frame class, you can try:
CMainFrame::OnPressMyButton()
{
CMDIChildWnd *vpChildFrame = MDIGetActive();
if (vpChildFrame != NULL)
{
CDocument *vpActiveDocument = vpChildFrame->GetActiveDocument();
if (vpActiveDocument != NULL)
{
DoSomeStuffWith(vpActiveDocument);
}
}
}
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hi. I am writing a dll that attaches to a program with no debug info. When I set an breakpoint in my code it does not stop at the breakpoint, it just ignores it and continues on it's merry way. If I put in __asm int 3 to force a breakpoint, it works and puts me in my code at the int 3 line. This is my second DLL where this problem has crept up.
Does anyone know why the visual c++ breakpoints are broken? (pun intended)
Thanks,
Clint
PS. If you were going to ask. Yes, I am in debug mode with my code.
|
|
|
|
|
I always thought breakpoints were disabled in release mode.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How have you got the debugging session configured?
I assume you have the DLL as the loaded project in VC and are using the exe as the "Executable for debug session".
This should work providing you have the dll compiled with the debug info.
Michael
|
|
|
|
|
Well I gave up trying to figure out why my application wouldn't break, so just made a new project and copied all my exisiting code into it. Everything seems to work fine. One thing that I did change is the DLL name. I had wanted a specific name so I renamed the dll. The new project is named the same as the dll and this works fine. I am curious if this is a known issue because with another dll, it is being renamed as well and I can't set bp's in it either....
Cheers
|
|
|
|
|
which one is "better"?
i know bool is more standardized but BOOL is more efficient, but which one is more commonly used, furthermore, which one should i use?
>>Roman<<
|
|
|
|
|
You answered your question. I think that is better to use the more efficient...
Do you prefer to use while(true) or for(;;) ?
Regards!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|