|
LOL - no worries. I can't tell you how often I've spent half a day looking for a = instead of == bug, or similar. It just goes that way sometimes.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I created a dll so i can call from the other program/project.
I want to know how to debug the dll from calling program.
here what i did
1)copy the myDll.h, myDll.dll and myDll.lib and paste them into the project where the program ( let's call it testingDll) will use them
2) from testingDll, go to project->setting->debug->
- choose Additional Dll from Categories
- add "c:\myDll\myDll.dll" on Location Name
3) from testingDll, go to project->setting->link->
- type "myDll.dll" in obj/lib modules
However, the program doesn't stop at where myDll break points are.
How to debug myDll please???
What did i do wrong?
thank you
|
|
|
|
|
Do it the other way around.
Copy the executable to the DLL debug directory. Set the executable to debug to the driving program.
|
|
|
|
|
I have an MDI application (obviously) however I also have multiple doc/views each with it's own icon, string res and so on...
My problem is this...when you have multiple doc/views whenever your app receives an OnNewDocument() MFC causes a little box to display asking which kind of document you wish to create
This sux...because I need more options than just a list box
I can override this functionality?
Thanks a bunch
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
|
Thank you kindly sir, i'll check it out
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Help,
I use the following code and it works, however, it causes a miserable assertion error. I am new to C++ and this is defeating me.
Thanks in advance for any help,
void Newstring::ConcanateString(Newstring& Alist)
{
Node *A = NULL;
Node *B = NULL;
A=Head;
B=Alist.Head;
if (A==NULL) {
A = B;
}
else {
curr = A;
while (curr->next != NULL) {
curr = curr->next;
}
curr->next = B;
}
B=NULL;
}
|
|
|
|
|
|
Thank you,
It is failing at the curr->next = B;
|
|
|
|
|
So have you set a breakpoint on that line to verify that a NULL pointer is not being dereferenced? If curr is NULL , a crash is imminent!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I can see a few potential problems, but since I don't know the rest of your the Newstring class, they may not be.
- It will fail if Alist.Head is NULL
- If the next data member is not initialised to NULL, it will fail.
- Your code wont compile. It will say "undeclared identifier 'curr'"
What is this function supposed to do? I'm not really clear on it.
Phil
|
|
|
|
|
Here is what I have so far: The error is coming up on the ConcanateString function.
Thanks
#include <iostream>
using namespace std;
struct Node
{
char item;
Node *next;
Node *prev;
Node *Tail;
};
class Newstring
{
public:
Newstring();//constructors
~Newstring();
void Append(char);
void ConcanateString(Newstring& Alist);
void Display();
private:
Node *Head;
Node *curr;
Node *prev;
Node *next;
Node *Tail;
};//end class
Newstring::Newstring()
{
Head = NULL;
curr = NULL;
prev = NULL;
next = NULL;
Tail = NULL;
}
Newstring::~Newstring()
{
Node *ptr;
while(Head!=NULL)
{
ptr=Head->next;
delete Head;
Head=ptr;
}
}
void Newstring::ConcanateString(Newstring& Alist)
{
Node *A = NULL;
Node *B = NULL;
A=Head;
B=Alist.Head;
if (A==NULL) {
A = B;
}
else {
curr = A;
while (curr->next != NULL) {
curr = curr->next;
}
curr->next=NULL;
curr->next = B;
}
B=NULL;
}
//Create strings
void Newstring::Append(char A)
{
Node *temp = NULL;
if (Head==NULL){
Head = new Node;
Head->item=A;
Head->next=curr;
}
else
{
curr=Head;
while(curr!=NULL)
{
prev=curr;
curr=curr->next;
}
temp=new Node;
temp->item=A;
temp->next=curr;
prev->next=temp;
}
}
//Display strings
void Newstring::Display()
{
if(Head==NULL)
{
cout << "List is empty" << endl;
return;
}
else
{
curr=Head;
while(curr!=NULL)
{
cout<< curr->item;
curr=curr->next;
}
cout << endl;
}
}
void main(){
Newstring String1, String2;
String1.Append('B');
String1.Append('a') ;
String1.Append('t') ;
String1.Display();
String2.Append('W');
String2.Append('i');
String2.Append('n');
String2.Append('g');
String1.ConcanateString(String2);
String1.Display();
}
|
|
|
|
|
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.
|
|
|
|