|
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.
|
|
|
|
|
I have a DLL called exceptions.
Now, if I add STL string parameters to its parameter list, my code crashes after entering into the code and after the code is complete....
i.e.
dll file:
class dll_export(delspec) CExcpetions
{
CExceptions();
CExceptions(std::string str);
}
cpp files
using namespace std;
CExceptions::CExceptions()
{
}
CExceptions::CExceptions(string str)
{
/// do something
}
///the calling exe
if( i == 1)
throw CException ("Hello");
As soon as it exits the constructor method,it throws an error.
Any ideas?
|
|
|
|
|
see the MSDN. there are a couple of STL + DLL articles there.
these two in particular might be helpful:
Q172396
Q168958
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
It seems to work with vector and maps, but when I try the following with strings it doens't compile:
#ifdef EXP_STL
# define DECLSPECIFIER __declspec(dllexport)
# define EXPIMP_TEMPLATE
#else
# define DECLSPECIFIER __declspec(dllimport)
# define EXPIMP_TEMPLATE extern
#endif
EXPIMP_TEMPLATE template class DECLSPECIFIER std::vector<int>; -- good
EXPIMP_TEMPLATE template class DECLSPECIFIER std::vector<char>; -- good
EXPIMP_TEMPLATE template class DECLSPECIFIER std::string; --fails to compile
Gives the following error:
error C2242: typedef name cannot follow class/struct/union
|
|
|
|
|
actually an interesting observation.
If I pass string by value (i.e void method (std::string x), it crashes.
If I pass string by reference (i.e. void method (const std::string & x),it does not crash.
take care
|
|
|
|
|
Assuming that you are using Visual Studio 6, download the patches to the STL it shipped with from www.dinkumware.com.
|
|
|
|
|
Every files has header which contains all information about the file.
Is there any function that read files' header.
Can I tell which application file to use to print/view the file base on the information of the file??
for example, I craeted test.txt file using notepad. then I rename the file as temp.t.
Is there any function to tell temp.t can open with notepad??
|
|
|
|
|
pnpfriend wrote:
Every files has header which contains all information about the file.
Not necessarily. It depends on the application that was used to create the file.
pnpfriend wrote:
Is there any function that read files' header.
Not a function per se, but there are a plethora of utility-like applications that do this. They're usually created on as as-needed basis.
pnpfriend wrote:
Is there any function to tell temp.t can open with notepad??
FindExecutable()
|
|
|
|
|
<br />
Not a function per se, but there are a plethora of utility-like applications that do this. They're usually created on as as-needed basis.
can you explain it to me again please.
What about By_HANDLE_FILE_INFORMATION structure?? nNumberOfLinks seem likes what I need.. but I dont' know how to use it..
Thank
|
|
|
|