|
I am saying about CTreeCtrl only.
|
|
|
|
|
If you want to traverse the whole thing then you have to go recursive.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
T.RATHA KRISHNAN wrote: I am saying about CTreeCtrl only
As suggested you need to use recursion, with help of CTreeCtrl class's functions. Have look at CTreeCtrl::GetNextItem,CTreeCtrl::GetChildItem,CTreeCtrl::GetNextSiblingItem .
Prasad
MS MVP - VC++
|
|
|
|
|
Why it is not possible to Delete/Move files using ::DeleteFile() or ::MoveFileEx() (which are in C:\ or C:\Program Files) in Windows Vista?
|
|
|
|
|
What do you think about a GetLastError call?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
BeliefInMe wrote: Why it is not possible ...
It is, as long as the UAC allows it.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In standard user, it says "Access Denied".
Any solution.
|
|
|
|
|
Ensure that you have appropriate rights for such an operation.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
im having problem with the code..
i want to print the information of node visited while approaching to goalnode..program is not checking any of the node specified and returns without any output.. code is linking properly, without any error or warning.. code is as follows:
#include "astar.h"
#include "math.h"
#include <iostream>
#include <stdio.h>
#define DEBUG_LISTS 0
#define DEBUG_LIST_LENGTHS_ONLY 0
using namespace std;
int NumofNodes=10;
int id=1 ;
double coordination[10][3]={{1,2,3},{14,26,38} ,{10,20,30}, {25,67,45},{35,47,55}, {36,56,54}, {44,56,89}, {32,34,56},{43,56,78}, {12,32,45}};
double GetX(int id)
{
return coordination[id][0];
}
double GetY(int id)
{
return coordination[id][1];
}
double GetZ(int id)
{
return coordination[id][2];
}
class MapSearchNode
{
public:
double x; // the (x,y,z) positions of the node
double y;
double z;
double id; // the index of the node
double g; // cumulative cost from s to this node
MapSearchNode() { x = y = z = 0; id = 0; g = NumofNodes;}
MapSearchNode( double px, double py, double pz, double pid, double pg) { x=px; y=py; z=pz ;id=pid; g = pg;}
double GoalDistanceEstimate( MapSearchNode &nodeGoal );
bool IsGoal( MapSearchNode &nodeGoal );
bool GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node );
double GetCost( MapSearchNode &successor );
bool IsSameState( MapSearchNode &rhs );
void PrintNodeInfo();
};
bool MapSearchNode::IsSameState( MapSearchNode &rhs )
{
// same state in a maze search is simply when (x,y,z) are the same
if( (x == rhs.x) &&
(y == rhs.y) && (z == rhs.z) && (id == rhs.id))
{
return true;
}
else
{
return false;
}
}
void MapSearchNode::PrintNodeInfo()
{
cout << "Node position :" << x << y << z;
}
// the heuristic function that estimates the distance from a Node
// to the Goal.
double MapSearchNode::GoalDistanceEstimate( MapSearchNode &nodeGoal )
{
double xd = double( ( x - nodeGoal.x ) );
double yd = double( ( y - nodeGoal.y) );
double zd = double( ( z - nodeGoal.z) );
// return xd+yd+zd;
return (double)(sqrt((xd*xd) + (yd*yd) +(zd*zd) ));
}
bool MapSearchNode::IsGoal( MapSearchNode &nodeGoal )
{
if( (x == nodeGoal.x) &&
(y == nodeGoal.y) && (z == nodeGoal.z) && id == nodeGoal.id )
{
return true;
}
return false;
}
bool MapSearchNode::GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node )
{
double parent_x = 0;
double parent_y = 0;
double parent_z = 0;
double parent_id = 0;
int i;
MapSearchNode NewNode;
if( parent_node )
{
parent_x = parent_node->x;
parent_y = parent_node->y;
parent_z = parent_node->z;
parent_id = parent_node->id;
}
for(i=0; i<NumofNodes; i++)
{
if( (parent_id != i))
{
NewNode = MapSearchNode(GetX(i), GetY(i), GetZ(i), i, NumofNodes);
astarsearch->AddSuccessor(NewNode);
}
}
return 0;
}
double MapSearchNode::GetCost( MapSearchNode &successor )
{
cout << GoalDistanceEstimate(successor);
return GoalDistanceEstimate(successor);
}
int main( int argc, char *argv[] )
{
AStarSearch<MapSearchNode> astarsearch;
unsigned int SearchCount = 0;
const unsigned int NumSearches = 1;
while(SearchCount < NumSearches)
{
// Create a start state
MapSearchNode nodeStart;
nodeStart.x = 1.0;
nodeStart.y = 2.0;
nodeStart.z = 3.0;
// Define the goal state
MapSearchNode nodeGoal;
nodeGoal.x = 12.0;
nodeGoal.y = 32.0;
nodeGoal.z = 45.0;
// Set Start and goal states
astarsearch.SetStartAndGoalStates( nodeStart, nodeGoal );
unsigned int SearchState = 0;
unsigned int SearchSteps = 0;
cout << "SearchState" << SearchState<< endl;
cout << "astarsearch.SearchStep()" << astarsearch.SearchStep() << endl;
cout << "searchng" << AStarSearch<MapSearchNode>::SEARCH_STATE_SEARCHING << endl;
cout << "succeeded " << AStarSearch<MapSearchNode>::SEARCH_STATE_SUCCEEDED << endl;
cout << " failed " << AStarSearch<MapSearchNode>::SEARCH_STATE_FAILED << endl;
if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SEARCHING )
{
SearchState = astarsearch.SearchStep();
SearchSteps++;
#if DEBUG_LISTS
cout << "Steps:" << SearchSteps << "\n";
int len = 0;
cout << "Open:\n";
MapSearchNode *p = astarsearch.GetOpenListStart();
while( p )
{
len++;
#if !DEBUG_LIST_LENGTHS_ONLY
((MapSearchNode *)p)->PrintNodeInfo();
#endif
p = astarsearch.GetOpenListNext();
}
cout << "Open list has " << len << " nodes\n";
len = 0;
cout << "Closed:\n";
p = astarsearch.GetClosedListStart();
while( p )
{
len++;
#if !DEBUG_LIST_LENGTHS_ONLY
p->PrintNodeInfo();
#endif
p = astarsearch.GetClosedListNext();
}
cout << "Closed list has " << len << " nodes\n";
#endif
}
if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SUCCEEDED )
{
cout << "Search found goal state\n";
MapSearchNode *node = astarsearch.GetSolutionStart();
#if DISPLAY_SOLUTION
cout << "Displaying solution\n";
#endif
int steps = 0;
node->PrintNodeInfo();
for( ;; )
{
node = astarsearch.GetSolutionNext();
if( !node )
{
break;
}
node->PrintNodeInfo();
steps ++;
};
cout << "Solution steps " << steps << endl;
astarsearch.FreeSolutionNodes();
}
if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_FAILED )
{
cout << "Search terminated. Did not find goal state\n";
}
// Display the number of loops the search went through
cout << "SearchSteps : " << SearchSteps << "\n";
SearchCount ++;
}
return 0;
}
please help me
|
|
|
|
|
s chiddarwar wrote: im having problem with the code..
what PARTICULAR problem are you having ? I will not do a review of that long a piece of code. !!1
|
|
|
|
|
i want output as nodes visited while searching..i have defined function print node info in that..
but its not giving me any output
|
|
|
|
|
Why don't you fire up the debugger and find out for yourself?
(VS6): "Debug build", Set a breakpoint (F9), and press F5
You would have saved 1 hour, 40 minutes...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
yes i did everything.
but its not working and thats why im asking you people for help..
im fighting with this from last 15 days ..
tried each and every option
|
|
|
|
|
s chiddarwar wrote: yes i did everything.
Including single-stepping your program in the debugger? While inspecting the values of the interesting variables? And watch the flow of the program?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
i did single stepping debug..
it gives me error C:\WINNT\system32\kernel32.dll', no matching symbolic information found.
and
it gives me output as goal node not found search terminated...
please some one help me
-- modified at 6:03 Thursday 26th April, 2007
|
|
|
|
|
can you send my please the A star algoritm to look at it
|
|
|
|
|
Hey,
I am trying to write a program that will run on about 40 computers at my work to monitor the processes. The way I would like to do it is run a small program in the background that receives notifications events from the kernel every time a process is created or terminated and then reports the information to a server computer. I am able to handle the communication with the server fine, but the receive notification events is causing me a bit of trouble. I have been trying to use http://www.codeproject.com/threads/procmon.asp <-- this example to do just that but it does not always report the process name, sometimes only the process id. If anyone is able to give me an example that works or point me in the write direction would be great.
Thanks in advance
Lepon
|
|
|
|
|
hello all,
i have made a sdi application, on button click event i have done some operations (which include starting of various ui threads).
Now my problem is when i click it some times it give don't send error and when i degug it using breakpoints it gives error
Unhandeled exception in xx.exe 0x0000005:Access violation
on doing ok another window pops up
Please enter the path for DBGHEAP.c
can anybody please tell me what kind of problem it can be and how to remove it
thanks in advance
|
|
|
|
|
neha.agarwal27 wrote: Unhandeled exception in xx.exe 0x0000005:Access violation
It is very difficult to guess the problem, without seeing code.
But, somewhere in your code, memory is handled/used in wrong way. Possibly, written out of boundry. So, check, how you have handled it.
Prasad
MS MVP - VC++
|
|
|
|
|
This is an excellent time to use your debugger. Follow the call stack until it reaches code that you have written. There you will find the cause of the error.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Can you post some code snippet for other's to see and check? It's very hard to tell with the information that you provide now. As said above it is possible that you may be writing to an invalid memory location causing the application to crash.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
neha.agarwal27 wrote: Please enter the path for DBGHEAP.c
You are trying to delete a pointer that's not yours or not allocated properly or deallocated before.
|
|
|
|
|
Hello friends,
For one of my projects I need to call jar files from the visual c++ application. Can anyone tell me how this can be done. If sample code is there then it will help a lot or the API if there is any.
Thanks for your reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|