|
|
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
|
|
|
|
|
while(true) and for(...) take the same amount of time. I have yet to see a compiler not optimize while (true) away.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Is bool less efficient? I don't think so...
I usually use bool for pure C++ logic, and BOOL for UI/Win API related stuff.
I have seen a lot of people mixing them and IMHO is not a good idea in terms of readability.
|
|
|
|
|
BOOL edges out bool in performance just by a very tiny amount.
Here are the rules I use.
If I am doing WIN32 code, I use BOOL. Otherwise, for the other 90% of my code, I use bool.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi!
Try this:
bool test_a = 3;
BOOL test_b = 3;
or that one:
bool test_a = true;
switch(test_b)
{
case 4:
break;
case 5:
break;
}
and the same for BOOL.
You will see the difference
Moreover: sizeof(BOOL) != sizeof(bool) ===> 4 != 1
I use always bool's, but when I deal with Win32 - I use BOOL's.
Mukkie
|
|
|
|
|
thanks, so for libraries i make, ill use bool if they're not windows-specific ;D
>>Roman<<
|
|
|
|