|
Hello,
I need to visualize a graph - simple nodes (rectangles or bitmaps) that are connected by an edge (line). It must be possible to move the nodes and the edges have to update to the new position of their target/Source node.
It's like an organization chart. How should I do that? Try to extend CListView? If so, how can I achieve that items in ICON Mode are moevable (as they are in the windows explorer)?
Any help apreciated!
Best regards,
Alexander
|
|
|
|
|
Hello, everyone!
I have a very complicated question (it seems to be one for me): I want to write a program in MFC (not ATL!) which behaves similar to the visual basic forms designer. I want to select different activex controls of my system, place them dynamically on a CView derived class and eventually want to embed vbscript to drive them. So i created a standard mdi application with activex support. Using the view class there is no problem to insert an activex control with CreateControl(...), it will be displayed and seems to be activated in-place, so far, so good. How can I disable/enable the control in the meaning of runtime / designtime mode? How to get events from the control? Up to now I was not able to find any description how to implement such a feature! There was something said about ambient properties, but how? Does anybody have an idea, how to do this?
|
|
|
|
|
Run-Time Check Failure #2 - Stack around the variable 'strReturn' was corrupted.
The following code bloack is giving me this error.
char *ProcessOBeginning(char *word, int *change)
{
char *Position = strpbrk(word,"oO");
if(Position)
if(isBeginning(Position,word))
{
if(isupper(Position[0]))
{
char strReturn[] = "O";
word = strcat(strReturn,word);
}
else
{
char strReturn[] = "o";
word = strcat(strReturn,word);
}
}
return word;
}
I think that it has todo with strReturn being allocated but I am not allowed to use memory management funcs for my project.
Steve
Not all who wander are lost...
|
|
|
|
|
With this piece of code:
char strReturn[] = "O";
you are only allocating one byte of memory for your string. The reason why you are getting the stack corrupt error is because you have the parameters backwards in your strcat function. I think that this is what you meant to do:
if(isupper(Position[0]))
{
char strReturn[] = "O";
strcat(word, strReturn);
}
else
{
char strReturn[] = "o";
strcat(word, strReturn);
}
The string that you want to append the data to goes in the first parameter of strcat. Also the value that is returned is the same pointer that is in word.
One more thing, you do not have to allocate a buffer for strReturn, you can simply do this:
strcat(word, "o");
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
actually I am trying to insert on o at the beginning, so the params aren't out of order. Is there something extra that I have to do? Thanks for the reply! How do you make those code blocks?
Steve
Not all who wander are lost...
|
|
|
|
|
First, in order to get the cool blocks of code type this:
<pre>
place your code here
</pre>
You can embed HTML in these statements.
If you want to put the "o" at the beginning of the string, then you were doing it somewhat correctly. But here is what you need to do to make it work properly.
if (strlen(word) < 253)
{
char szReturn[256];
strcpy(szReturn, "0");
strcat(szReturn, word);
strcpy(word, szReturn);
}
The reason that I check the length of word is to prevent a memory overrun because we are only allocating 256 bytes for the string.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks for all your help. I have a general question about stack corruption. I can't seem to find much information on it anywhere. Generally how is this caused? I think its because to much data is on the stack. Is this correct? How can I avoid this in the future? Thank you.
Steve
Not all who wander are lost...
|
|
|
|
|
Hi
The following information is in a .txt file. I nead to read through it, pick out certain parts and send the information to a DB.
Memory SM, location 1
Name: John Doe
Number: +12345
Memory SM, location 2
Name: Jane Doe
Number: +54321
Memory SM, location 3
Name: Jack Doe
Number: +112233
...
Here is the code I use to get the info I need from the first 3 lines:
/***********************************************/
FILE *stream;
stream = fopen( "number", "r" );
char bufLine1[30], bufLine2[30], bufLine3[30];
fgets(bufLine1, 30, stream);
fgets(bufLine2, 30, stream);
fgets(bufLine3, 30, stream);
fclose( stream );
char *pNext1 = &bufLine1 [21];
char *pNext2 = &bufLine2 [9];
char *pNext3 = &bufLine3 [11];
strcpy(bufLine1, pNext1);
strcpy(bufLine2, pNext2);
strcpy(bufLine3, pNext3);
//information sent to database
/***********************************************/
Is there a way that I can put this in a loop and then start reading the 4th, 5th & 6th line and send their details off to the DB. And the go on to the 7th, 8th & 9th etc? I persume it's something like a pointer in a text file but I'm not sure how to do this.
Thanks for any help.
Alan
|
|
|
|
|
Yes,
just don't close the stream and do a while(EOF)!
Cheers
Al
|
|
|
|
|
1. whether the length of bufLine1 is more than 22, if not,
the pointer(pNext1) maybe is out of control
2. you can use substr function
|
|
|
|
|
I made a VC6 freeware image file browser dedicated to Poser - the 3D character animator. The app works fine (about 5000 users) but I've got a W2K user with a strange problem. When he loads both my browser and Poser, Poser slow down. Each of the application alone work fine.
I just wonder if there is a tool or technic that could help me see what happens ? Any idea would be welcome, of course )
My browser is compiled under W98, I know the first thing to do is to recompile under W2K but I can't afford a new release untill late May. My purpose is to find the way to solve the problem so that next version is clean.
Thank you
Yarp
|
|
|
|
|
Do you know for sure that it is a memory problem?
Have you looked at the possibility that you may be locking files, or both programs are using files at the same time and that causes problems?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi Kilowatt,
Yep, this is a possibility. My browser does open files on a specific folder to display inner informations (but I only open those files with read access with fopen function).
The user told me the slowdown occurs each time he loads the 2 apps. So it seems impossible this come from a file lock. Moreover as I told above there are thousand other users and this is the only report of such a problem.
Thank for taking time to reply,
Yarp
|
|
|
|
|
After he opens both apps, and the slow down occurs, if he closes down your app, does Poser speed up again? Does your app run slowly when both apps are running?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
> After he opens both apps, and the slow down occurs, if he closes down your app, does Poser speed up again?
Thats a pretty good question, I will ask him. What if the answer is Yes or No ?
Does your app run slowly when both apps are running?
No, just Poser. Poser is slow and sometimes even crashes. Memory management in Poser is poor and Poser crash are frequent (the reason for this is that Poser is a Mac based application and the whole GUI has been rewritten, I suppose memory management too).
Yarp
|
|
|
|
|
yarp wrote:
> After he opens both apps, and the slow down occurs, if he closes down your app, does Poser speed up again?
Thats a pretty good question, I will ask him. What if the answer is Yes or No ?
If the answer is yes, Poser speeds up, then your app may have something to do with Posers problems. If the answer is No, Poser is still slow, then it is more likely that Poser has some problems that only become apparent when another app starts up. Then I would suggest that you try to see if any other programs affect Posers performance.
In either case I would ask the guy to try running some other applications with Poser, not including yours, to see if he can duplicate the problem.
How much memory does this guy have on his machine? How much RAM does poser recommend? Have you been able to duplicate the problem on your machine? Also, have you been to Posers website to see if they have reported any problems like this?
I am just guessing, but hopefully some of these questions will get your started down the right path.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I am wondering too if he just doesn't have enough system memory.
Does the disk thrash when both programs are running. (i.e. the disk like blinks a HELL of a lot.) If so, this could be cause by a lot of page faults.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Unfortunately the answer is yes and no. Below is the answer I got from him:
"A very, very good question. About half the time, Poser will "speed" up to
it's original self, and the rest of the time, it pokes along like a turtle
in molasses high in the Alps in February, as if P3dO was still open. I've
checked to see which processes were still running (nothing unusual) and have
even flushed memory caches (doesn't have any effect).
I have a third-party memory tracking program (a de-bugger, if you will) that
will tell me when a block of memory has been "captured" by a program and
that refuses to release it. It hasn't reported anything unusual."
About other application running, he said this only occured with mine. Although people seldom run many app with Poser.
He has 1 Gb SDRAM on his machine a dual P3 750 Mhz and enough disk space. This is way enough for Poser use. I know the Poser web site well and I'm sure they won't answer such a question because they can't.
Yes, you're guessing for me but it's good to have some backing. I'm affraid the only thing left is to pray for a W2K compilation to solve the problem. I really can't see from here what is wrong with just that machine.
Thank you for your much appreciated help
Yarp
|
|
|
|
|
Have him check the W2K event viewer and see if anything strange is in there. Maybe he has EDO memory and one of the sticks is starting to go bad. Guessing at this point.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi Tim, I will ask him about the page faults. I don't think he has EDO memory this is a recent machine but we will see.
I was thinking as you did he might not have enough memory - altough 1 Gb - but I was rather thinking about virtual memory. I had such an adventure on a 700 Mhz Vaio with WMe. The machine ran with 128 Mb RAM and the many applications launched at system startup got more than 100 for themselves.
Yarp
|
|
|
|
|
The answer is that no other programm slows down but Poser when P3dO is loaded and there is no page fault.
Yarp
|
|
|
|
|
Um... wow...
It really sounds like it has to be an interaction problem between the two programs then.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I'm affraid. But I really can't see which one. I was also thinking about a shared .dll.
I'll try recompiling, some functions (like fopen) need to be recompile to run properly under NT. We'll see if this is enough.
Yarp
|
|
|
|
|
I need to display a bitmap without a windows frame. I've seen code here at the code project that can do this but can't find it again.
Del
|
|
|
|
|
Use the sample of splasj Screen. That will teach you how to do that...
If you don't find that sample, only add in a simple project, the componnet of splash screen, that you can find in the component gallery, and you will can see the class that make that....;)
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|