|
Is this homework ? Just because, if it isn't, you could make life a lot easier by using the std library.
It seems likely to me that you're blowing up because you're trying to access a member of an object that does not exist, so if you're accessing curr->next, curr is either NULL or invalid. So the problem ocurred earlier, you're just seeing it when you try to access the object which is not what you'd expect it to be.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
It is homework. I get the expected outcome but I also get a debug assertion error. I tried what the help told me to do ie...breakpoint, Callstack and still could not find the error. All I am doing is adding 1 list to another.
Thanks for any help
|
|
|
|
|
OK. In that case, what is happening is that debug mode keeps track of memory being used, and the assertion is telling you that you've not managed your memory properly. You won't get it just from not deleting memory, you must be walking over some memory in a way that doesn't break your program execution ( but Murphies Law says it will when your teacher looks at it ), but which the memory manager doesn't like ( probably with good reason ).
I find that often when I have a problem like this, the easiest way to solve it is to rewrite the code, and to really focus on what you're doing with memory as you do so. You'll probably find that the new version will work, and it will be quicker than going through, trying to find your mistake.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
I tried your code, and it works fine for me, except for when the application is exiting. The code for everything else looks like it is fine.
Both String1 and String2 try and delete the same node, and this causes the program to crash. Both strings containt he same node because of the concanateString method.
|
|
|
|
|
Thank you. I will try to find a way around that.
|
|
|
|
|
You need to either copy the memory so only one string consumes each one, or impliment a reference count.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hello,
I am wondering if I can implement a splitter window without a divider? Basically what I am looking for is a setup similar to preferences in Winamp or AOL IM when they have a navigation screen on the left and corresponding views on the right. Clicking on each items brings on a different view on the right. I am not sure how it is implemented and how should I approach this in my project. I thought that it is very similar to a splitter window functionality only without showing a divider...
Does anyone have any comments?
Thank you,
Dmitry
|
|
|
|
|
CSplitterWnd::OnDrawSplitter
I'm drinking triples, seeing double and acting single
|
|
|
|
|
I'm still new to usinging MFC and having problems getting any messages from a new window I create. Could someone please help.
For testing purposes I just created a standard MFC single document program called Test.
In the CTestView class I added logic to create a new overlapped window using the following code:
LPCSTR lpszClassName = AfxRegisterWndClass (
CS_OWNDC | CS_DBLCLKS,
0,0,0);
wndMyCWnd.CreateEx(
WS_EX_OVERLAPPEDWINDOW ,
lpszClassName,
"My New Window",
WS_OVERLAPPED | WS_VISIBLE |WS_CAPTION | WS_SYSMENU |WS_VSCROLL,
200,200,300,400,
m_hWnd, NULL, NULL);
CDC *myDC = wndMyCWnd.GetDC();
myDC->TextOut(10,10,"This is a test",14);
This works fine, my new window is created and I can write text to it. The problem is I can not figure out anyway to get any of the windows messages (IE: WM_MOUSEMOVE) from the new window. I tried putting the above logic in a new class by itslef and then mapping out the messages like I did in the CTestView class, but still unable to ever get any of the messages from the new window I created. I must be missing something simple here, but can not seem to figure it out. Any help would be greatly appreciated.
Eric
|
|
|
|
|
Hello,
I want to use a PropertySheet within a PropertySheet. Normally we can add property pages in PropertySheet but can I add Property sheet or not. I am using MFC classes CPropertySheet and CpropertyPage.
Aamir Butt
|
|
|
|
|
What exactly are you asking here, are you saying can you create a property sheet from within another property sheet, or are you asking if you can display a property sheet within another property sheet???
Mark
|
|
|
|
|
Yes, I am asking that can I display a Property sheet within another Property Sheet.
to be more clear, I have a Property Sheet with two Property Pages in it. Now, I want one of these Property Pages to be a Property Sheet itself in which I could be able to have other Property Pages as well.
|
|
|
|
|
I have been programming for about 2 years now and covered alot of stuff, basic all the way through some advanced topics but today it occured to me that I know all this stuff but don't know how to make header files. Can anyone please show me how to make header files. Not in visual c++ 6 but in old-c++ (console c++) Thankyou.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
The basic idea is that the header file defines the behaviour of your class and the class contains the implementation. To make a header file, just fill in the pertinent info and save it as a ".h" file. Then #include that header file at the top of your .cpp file
Example:
#include "anyheadersthisclassneeds.h"
class YourClass
{
public:
YourClass::YourClass();
~YourClass();
void YourClass::Method1();
void YourClass::Method2();
protected:
int nClassMember1;
int nClassMember2;
CString csClassMember3;
};
|
|
|
|
|
OK this is the prototype defs. but How do you define the actual functions, in the header files or the source files.?
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Snyp wrote:
this is the prototype defs. but How do you define the actual functions, in the header files or the source files.?
You could define the functions inline to the header file, however the majority of the time you will find the implementation in a coresponding .cpp file. So for the class Terry provided you might have the following:
#include "YourClass.h"
void YourClass::Method1()
{
}
void YourClass::Method2()
{
}
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
THANKYOU!!!;P;);P;);P ;P;) ;);P
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Hello!
I am trying to intercept some calls to system DLLs. I've read some articles about how to do that.
Now I want to create a proxy DLL and have a problem. The DLL I want to hook (GDI32) has so many function calls that reimplementing everyone seems impossible.
Is it possible to redirect calls to the proxy DLL by standard? I mean, all functions that aren't exported by the proxy DLL will automatically redirected to the original DLL?
Thanks in advance!
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
your question is kinda strange..
you hook apis by creating a dll, which has some of the original functions, and then you redirect these calls to your own dll.
so where is the problem?
Don't try it, just do it!
|
|
|
|
|
The problem is that when I only implement some and not all of the API exported by the original DLL the executable will complain about missing external references.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Anyone experienced any problems (memory leaks in my case) with Windows Media Format SDK? I'm using it to retrieve content from network and write to local disk, but looks like it has a memory leak. This is the code I use:
IWMReader* pReader = NULL;
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
HRESULT hr = WMCreateReader(NULL, WMT_RIGHT_PLAYBACK, &pReader);
pReader->Open(L"some_url_here", this, NULL);
WaitForSingleObject(m_hEvent, 60000);
pReader->Close();
pReader->Release();
CloseHandle(m_hEvent);
Both callback functions (OnStatus and OnSample) are empty, just returning S_OK. You see, I'm not starting it, only opening. After I call Open function, memory jumps for about 2.5Mb. When I call Close and Release it goes down around 1.Mb, leaving 1.5Mb in "air". Anyone knows about this?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Is the memory usage going up by 1.5MB for every file, or just the first? If it's just the first then that's normal. The first time you use any in-proc COM server, your process has to load the server DLL (and any others that it uses) so your working set will increase.
If the working set is an issue, call CoFreeUnusedLibraries() to try to unload in-proc servers with a ref count of 0.
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Well it happens every time I create and open IWMReader. For example (not the full code, just to keep it simple):
WMCreateReader(NULL, WMT_RIGHT_PLAYBACK, &pReader);
pReader->Open(L"URL");
pReader->Close();
pReader->Release();
put this in loop and you get the memory to 100Mb in just a few minutes. But if you won't call Release (and of course won't create it again), mean just Open and Close, then everything is ok. I'll try your suggestion though tomorrow at work. Will see if this is the problem. Thank you
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Philip Patrick wrote:
put this in loop and you get the memory to 100Mb
hmmm, that is worrysome. Which version of the FSDK? I use the FSDK at work, and it's possible that a user could end up doing similar code in a loop over many files, so I'll give it a try at work tomorrow too.
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|