|
JaisonCodeMan wrote:
Doesnt this function expect me to pass the value fo the diaog as mentione in the resource.h file??
The function which i haveshown expects only the no of View which u want to be there.. forexample FIRST_VIEW or what so ever it is...no it is not the identifier of the dialog as mentioned in resource.h.. it isjust the constant like FIRST_VIEW or SECOND_VIEW which ihave declared myself..
JaisonCodeMan wrote:
Doesnt this function expect me to pass the value fo the diaog as mentione in the resource.h file??
yes u need to have seprerate class for each dialog which u want to make as view of document.
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
how i can change the title of the application ?
|
|
|
|
|
simple!! SetWindowText()
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
If you want to change the title of an application that uses the Document/view framework then you will have to override PreCreateWindow and set the style to eliminate the WS_CAPTION property otherwise MFC automatically updates the application title to the file name which can be very frustrating!
See mike dunn's C++ FAQ here[^]
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|
i want to monitor for all incoming and outgoing TCP conenctions on some PC. which APIs to use?
NetMon apis?
or someone having experiecne in this plz guide me!!
Thanx
Shoaib
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Is there a difference between this:
bool foo(int& a);
and this:
bool foo(int &a);
Thanks.
|
|
|
|
|
To you, the preprocessor, or the compiler? Where you put spaces, and how many you put, is irrelevant to the compiler as the preprocessor removes them all before sending the tokens to the compiler.
Take something like:
#include < stdio.h >
int main( int argc, char **argv )
{
printf("Hello World!\n");
return 0;
} You could have just as easily written it as:
#include < stdio.h >int main( int argc, char **argv ){printf("Hello World!\n");return 0;}
The compiler wouldn't have cared.
|
|
|
|
|
No, however int& is preferable because it makes it clear that the type of "a" is "int&"
Yes, you can start a religious argument over this issue. I don't care. I'm right.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Michael Dunn wrote:
Ericahist
Excellent! I've finally been able to increase my "Pictures of Erica" collection from a measy two to....six. w00t! I suppose six is better than nothing though!
Thanks!
(been an Erica fan since back the GoogleFight of Erica (yeah!) vs Britney (boo! hiss!)) <insert link to the aforementioned post>
I prefer to wear gloves when using it, but that's merely a matter of personal hygiene
[Roger Wright on VB]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
[Rich Cook]
|
|
|
|
|
I am working on a program where I keep background textures in a separate DLL (for simple upgrade possibilities).
I use LoadBitmap in the DLL and I export the pointer to the asociated CBitmap to the application.
Everything works fine, except that refresh is quite slow now.
Does anyone know/recognize this behaviour , or did I do something else wrong?
If someone has a clue and solution, please let me know.
Bert....
|
|
|
|
|
you can load resource in the application directly instead of loading in
dlls.
when you load resource in the application after load some dlls.the system will
look for the resource not only in the application but also in dlls it has loaded.
i hope it works well...
gucy
|
|
|
|
|
WEll, I have been using Borland C++ Builder most of my life, and it always made GUI design a breeze.
But, now I'm using VC++; I've used it before when writing, say, DLLs, so it hasnt been a problem; however, now that I'm designing a GUI, its causing me lots of headaches.
For instance, I only now just found that the filetypes that it looks for when doing, say, file->open, is in resource string table. Or rather, thats what it lists for captions at least, not necessarily where its actually using for the filter.
So, I went and changed the caption - and, of course, its just the caption, and not the filter. So, I've been digging to see where the wizard that created my project is actually saving the filter for file-opening, as I want to add more filetypes to its initial filter.
Meanwhile, I'm also curious, if I wanted to do so, I do I add menus and toolbars to children of the parent window in a MDI project?
As I've been a developer using Borland, I've gotten spoiled with GUI Development
James A Beggs
American Quarter Horse Association Manager of Product Development
|
|
|
|
|
Hi there, I am having trouble with my dialogues using the cross X in the corner of my dialogue doesn't seem to call PostNcDestroy where I perform clean up of the object. I was expecting the WM_CLOSE message to be generated which calls the default DestroyWindow.
Can anyone explain why it is not being called?
Andy
|
|
|
|
|
Interesting. I have a modeless dialog I use in a little app that simply shows a progress bar while the app is running. When I click the 'X', it indeed calls the dialog's PostNcDestroy() function.
|
|
|
|
|
I don't think it is called in modal dialogs.
John
|
|
|
|
|
I don't understand it, I stepped through some of the example code in Nishants tutorial and closing the dialogue with the X definitely calls PostNcDestroy, however it doesn't in mine, despite the fact that clicking the X sends the WM_CLOSE message, which I think should call destroy window. I'm confused, the only difference I can see in my code is that I call ShowWindow in the constructor of my dialogue, and not in the external code. ??
Andy
Still confused
|
|
|
|
|
Is your dialog modeless then?
John
|
|
|
|
|
It's definetly modeless, I create a new dialogue like this
if(!m_pDlgComms)
{
m_pDlgComms = new CCommsDlg(this);
etc
which is then constructed like this
CCommsDlg::CCommsDlg(CWnd* pParent )
: CDialog(CCommsDlg::IDD, pParent)
{
m_sCommsInput = _T("");
m_sCommsOutput = _T("");
if (Create(CCommsDlg::IDD, pParent))
{
m_pParent = pParent;
ShowWindow(SW_SHOW);
}
}
and here is the PostNcDestroy which is called whenever I force a destroy window using a button for example
void CCommsDlg::PostNcDestroy()
{
CDialog::PostNcDestroy();
if(m_pParent)
{
((CBuggycontrolappView*)m_pParent)->m_pDlgComms = NULL;
((CBuggycontrolappView*)m_pParent)->m_nCommsToggleState = 0;
}
delete this;
}
but not when I use the cross. Even though there is a WM_CLOSE message
Andy
|
|
|
|
|
Ok, I understand your problem but I have not seen this in the past. Do you have code for OnCancel() ? Destroying the window with the X button should call OnCancel().
John
|
|
|
|
|
When WM_CLOSE is sent, you need to send call DestroyWindow()
For example:
CCommsDlg::OnClose()
{
DestroyWindow();
}
This is how you close a modeless dialog. When you call DestroyWindow() then of course you will get to
PostNcDestroy().
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hello again guys
I've solved the problem I think. I put in the handler for WM_CLOSE, and the following code
void CCommsDlg::OnClose()
{
CDialog::OnClose();
DestroyWindow();
}
This now works fine, doing exactly what I want. Previously the code I had used was
void CCommsDlg::OnClose()
{
DestroyWindow();
CDialog::OnClose();
}
which gave me the exception. I'm still not sure why though no doubt one of you guys can inform me and I'm still puzzled by the fact that the code given in Nishants example in the dialogues section makes no call to OnClose at all and still calls PostNcDestroy . However now my code works I'm a happy man though it'd be better if I understood why!
Cheers
Andy
|
|
|
|
|
As Nishant explains in his article a modal dialog makes a call to DestroyWindow() and as a result to PostNcDestroy().
But in your example you are building a modeless dialog and Windows is very specific about this case. You need to call DestroyWindow() to close a modeless dialog. Why? I don't know. This decision was made by windows. I will do a little bit of investigating though to find out. However, in this case OnClose() doesn't generate an WM_DESTROY message afterwards.
And by the way this part of your code
DestroyWindow();
CDialog::OnClose();
generates an exception because you are sending a WM_CLOSE message to a window that doesn't exist.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I have a hierarchy of ListCtrl-derived classes. Everything is working fine, except when OnDestroy is called, it seems to be called in the wrong order, for an object of type CList2:
eg.
class CList1 : public CListCrtl
{
}
class CList2 : public CList1
{
}
Am I missing something really obvious here, or is this correct?
There are 10 kinds of people - those that get binary and those that don't.
|
|
|
|
|
How many objects did you instantiate? What were they?
Kuphryn
|
|
|
|
|
kuphryn wrote:
ForumVisual C++
Subject:Re: OnDestroy called for base class first...
Sender:kuphryn
Date:15:39 13 Jun '03
How many objects did you instantiate? What were they?
Only one, the last one in the hierarchy.
I think I've found my problem - it all comes down to a design that didn't take into account the customers next move...
Basically, I'm trying to fit a square peg in a round hole, and it isn't working at all.
Thanks for replying anyway...
There are 10 kinds of people - those that get binary and those that don't.
|
|
|
|