|
Thanks. That was an easy solution. Is this a typical way of dealing with these kinds of issues? Seems kind of a work around a larger issue to me.
Thank you!
Dan
|
|
|
|
|
groover4life wrote:
Is this a typical way of dealing with these kinds of issues?
I guess it is, but I've never experienced the problem you're describing. What exactly are you doing in OnCloseDocument?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
I have several Objects that are instantiated upon the opening of a new document to store the data in the formats I need. So I'm creating them dynamically using new. In the OnCloseDocument, I'm cleaning up the "mess" from the current document by checking to see if the pointers are null (basic assertions) and if not null, then I call delete <class> to clean out the memory.
What was happening is the document went away along with the pointers, so those pointers I was cleaning up were pointing out in no-man's land resulting in the memory access error I was having.
Once again, thanks.
Dan
|
|
|
|
|
Just initialize pointers to NULL in CYourDoc c'tor. It's OK to call delete on NULL pointer - it will be no-op. You may also consider using std::auto_ptr.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
If i add an IP Address Control to my application and run it exits right after it has started, the dialog doesen't even appear. this happens both in debug and release mode.
|
|
|
|
|
|
I have what might be a basic C++ question but I'm hoping someone will indulge me.
In my code I allocate a string and then pass it (as a TCHAR*) to a dialog class through the dialog's constructor, where I assign it to a member TCHAR*. The string is later modified in one of the dialog class's functions and I was hoping the changes would be passed back to the calling code, but they are not, the string remains blank ????
Anyone have any idea on how to go about this ?
Thanks in advance
|
|
|
|
|
Check whether you are working with allocated objects and pointer to them. I think in some of your code you allocate a copy and your lost your way. Why don´t you give back your resulting string (as function like "GetResultString()". It also would give you the opportunity to check the DoModal() Result.
|
|
|
|
|
Show us the code where you "assign it to a member TCHAR*" please.
Signature space for rent. Apply by email to....
|
|
|
|
|
Its quite common to find applications with multiple windows or those that spawn other applications or other instances of itself.
For example IE can be launched via some 1. jscript code, or 2. by the user selecting IE to be launched from a toolbar, start menu etc, or 3. launched by some other application.
If launched using 1 or 3 how do I find out which application or which browser instance is the launcher?
|
|
|
|
|
Is it possible to have a window with only close button as like dialog box.if it is so how to specify while create window.
|
|
|
|
|
Yes!
use the resource editor, when creating a dialog template, just remove the Ok button; or derive a class from CDialog and add it (Close button ) or remove the Ok button manually in the OnInitDialog method.
Max.
|
|
|
|
|
Or, if you are using SDI/MDI framework, add this line in
CMainFrame::PreCreateWindow (CREATESTRUCT &cs)
{
...
cs.style = WS_SYSMENU;
return TRUE;
}
|
|
|
|
|
I have several owner drawn CButtons created on a View. these buttosn are used to scale several plots on the same view. Because the buttons do the same thing (just to different plots, depending on which button is clicked) I want to use the same code to perform the actions. Ie. I do not want 6 different button performing the same actions.
What I want to do is when a button is clicked, detect which plot the user wishes to scale depending on the location of the particular scaling button they clicked. I am having a problem getting the location of the button within the view when clicked. Can anyone offer some assistance here???
Thanks
|
|
|
|
|
You can handle WM_COMMAND message in PreTranslateMessage of your view. wParam contains control ID, lParam contains handle to the control sending the message. Having control handle you can get it's rectangle.
|
|
|
|
|
Maybe ::GetMessagePos() can help you to get the position of the mouse click in the click-handler.
Or you could use differnt instances of the same CButton-derived class, having a constructor taking and storing the associated plot number in a member variable.
The click-handler would then work on this plot number.
This probably is the better way to do it.
|
|
|
|
|
GetMessagePos works like a charm.
It gives position in terms of the entire screen instead of the view, which I would like, but it will do the trick.
A big Thanks!
-Merle
|
|
|
|
|
I had a similar problem when writing a context menu for CTreeCtrl.
You simply do CYourView::ScreenToClient(), and voilá - the client-specific coordinates!
|
|
|
|
|
In the past, many libraries and samples are simulating VC interface. I'm wondering if there's the same stuff for VS.NET interface ?
|
|
|
|
|
I am trying to print the contexts of a CDialog that contains several ActiveX controls. I am looking for a function that I can send a pointer to the CDialog and it will prompt the user for the Printer to use. It would be helpful if the function would take into account Portrait of Lansscape. Any help would be appreciated.
Craig Berry (Developer)
|
|
|
|
|
I need any ideas about http requests catching, not only IE but also Netscape and Opera.
I think "AD Muncher" is very cool, it can catch all HTTP requests. FAQ about AD Muncher
Thanks
|
|
|
|
|
Google for "HTTP Proxy"
Signature space for rent. Apply by email to....
|
|
|
|
|
I need code piece, not the soft.
|
|
|
|
|
Hi,
This will sound very basic and silly!!!
but can someone help me out with finding out how to go about
doing a substr() in C++;
Thanks,
Brgds,
John
|
|
|
|
|
doing a substr() in C++;
You use CString.Mid() (this requires MFC), or
you use std::string.substr() (this is standardized and portable), or
us use strstr(), the plain old C-Library function.
Its up to you.
|
|
|
|