|
Then you do have a problem
Presumably there's a documented API between your app and the plugins?
Could you create a shim, using templates or similar, that protects all plug-in calls with exception handlers?
COM is still an option 
|
|
|
|
|
In general wanting the host application to survive an in-process plug-in crash is misguided. It can leave the application in an unstable state and cause problems at a later time which can seem unrelated to the original problem and are much harder to fix. The classic example is a corrupt heap which often manifests in a crash in the allocation or de-allocation of memory some time after the actual real problem.
Steve
|
|
|
|
|
Hi All,
Recently I heard about .NET profiling API and want to implement it. To do that, I require to build an ATL based COM project. Unfortunately I am using Visual C++ express edition which doesn't supports ATL. So I googled for a free alternative to ATL. I got COMET[^] and DispHelper[^]
Can I use these libraries to implement .NET profiling API? Thanks for your kind advice.
Regards,
Thomas
|
|
|
|
|
COMET looks best
good luck 
|
|
|
|
|
What do you think is the best control for getting keyboard and mouse input? I need to be able to over ride OnKeyDown, OnChar, OnMouseMove, OnLButtonDown & Up. I need to be able to control every aspect of how to respond to the input.
CRect Pos(50,200,200,220);
CWnd MyWnd;
MyWnd.Create(_T("WHAT HERE???","MyInputWnd",WS_CHILD|WS_VISIBLE,Pos,this,1);
Thanks in advance.
|
|
|
|
|
What do you mean by 'best'? The issue is rather what is the purpose of your Window; keyboard and mouse input is always available.
The best things in life are not things.
|
|
|
|
|
Dear all,
I have the task to wrap a list<myobject> inside a .NET wrapper, and actually after some heavy researching and editing, it seems to work, but I dont trust that I have understood all unmanaged issues correctly.
First, I found I should add an operator overload and a copy constructor to my class:
RawCoil::RawCoil(const Core::RawCoil& pParam)
{
*this = pParam;
}
RawCoil& RawCoil::operator=(const RawCoil &obj)
{
this->Id = obj.Id;
return *this;
}
Is this correct?
Then, there is the main list variable, which is used inside the unmanaged code. When is the memory allocated/freed, this I don´t understand:
list<RawCoil> coils;
Another interesting questions. The List<> from .NET will arrive with new elements from time to time, and I have to synchronize it to the unamanged code:
int unmanageCoils(List<Coil^>^ managedCoils, list<Core::RawCoil> *unmanagedCoils)
{
unmanagedCoils->clear();
for(int i=0;i<managedCoils->Count;i++)
{
Coil^ coil = managedCoils[i];
Core::RawCoil newCoil;
newCoil.Id = ManagedToSTL(coil->coilId);
unmanagedCoils->push_back(newCoil);
}
return managedCoils->Count;
how is the memory allocation treated for the list elements?
The thing is I want to prevent any leaking of memory, as I am normally only developing in C# and quite paranoid when I have to switch back to old times
kind regards Florian
|
|
|
|
|
I make the program to show the leaves in BST, but how to show only nodes that have leaves as children?
int OnlyLeafNodes(Elem *t)
{
if(NULL == t) return 0;
if(NULL == t->left && NULL == t->right) cout << t->key << endl;
else return OnlyLeafNodes(t->left) + OnlyLeafNodes(t->right);
}
Here is the INPUT and OUTPUT that I use for test. It has to show 4, instead of 2 and 5. Because 4 is the node that has only leaves.
http://img40.imageshack.us/img40/1421/treex.jpg
|
|
|
|
|
something like this should do it
int OnlyLeafNodes(Elem *t, int currentDepth=0)
{
if(!t)
return currentDepth;
currentDepth++;
int leftDepth=OnlyLeafNodes(t->left,currentDepth)-currentDepth);
int rightDepth=OnlyLeafNodes(t->right,currentDepth)-currentDepth);
if(max(leftDepth,rightDepth)==1)
cout << t->key << endl;
return currentDepth;
}
I haven't compiled it, sorry, but the general idea is to find all children who only descend one past the currentDepth
|
|
|
|
|
|
sorry
#define max(a,b) a>b?a:b
|
|
|
|
|
Yes I define my own Max function, but why the output is 4,3,1 and not only 4?
|
|
|
|
|
i think the return should be
return currentDepth+(maxDepth,rightdepth);
|
|
|
|
|
maxDepth is? and why is it in brackets? Is it a function or something? i don' t know
|
|
|
|
|
OK I think I did it it has to be
return currentDepth - leftDepth + rightDepth;
|
|
|
|
|
Now If you can explain me how the whole function works...
|
|
|
|
|
it works by only printing those nodes who have only one depth below them, no more
|
|
|
|
|
return currentDepth+max(leftDepth,rightdepth)
|
|
|
|
|
And how to call the function? I mean what has to be the second argument innerDepth. I call it with the tree and the Height as second argument and it gives me 4, 3, 1 as output. I need only 4.
|
|
|
|
|
call it with
OnlyLeafNodes(rootNode,0);
|
|
|
|
|
Hi Everyone,
When i build my newly ported(VS6.0 to 2008) code from VS2008 UI, It builds fine.
When i build it using
MSBuild XXX.sln /t:Clean /p:configuration=Release
MSBuild XXX.sln /l:FileLogger,Microsoft.Build.Engine;logfile=MyLog.log;Build /p:configuration=Release
I get 100's of
nafxcw.lib(winctrl1.obj) : error LNK2005: "public: virtual int __thiscall CStatic::Create(char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int)" (?Create@CStatic@@UAEHPBDKABUtagRECT@@PAVCWnd@@I@Z) already defined in mfc90.lib(mfc90.dll)
nafxcw.lib(winctrl1.obj) : error LNK2005: "public: virtual __thiscall CStatic::~CStatic(void)" (??1CStatic@@UAE@XZ) already defined in mfc90.lib(mfc90.dll)
I used the NODEFAULTLIB option in UI. With this option, UI is also failing to build.
If somebody ran into same issue, please advise.
|
|
|
|
|
Hi,
i sometimes get a overflow at runtime when using boost::regex_match...
here's what i'm doing (This code works!):
CString path = "abcd";
boost::regex r("bc");
boost::tmatch what;
if(boost::regex_match(path, what, r))
{
}
else
{
}
When i'm changing the code to
boost::regex r("*bc");
i'll get the error?
I have also tried 'BOOST_REGEX_NON_RECURSIVE' or 'BOOST_REGEX_RECURSIVE'.
Thanks
|
|
|
|
|
boost::tmatch what;
if(boost::regex_match(path, what, r))
Variable what has not been initialized, is this correct?
The best things in life are not things.
|
|
|
|
|
Yes, that's correct.
My code is like the first sample of this link.
|
|
|
|
|
Sorry, but I cannot see anything wrong there. I guess you need to use the debugger and try to trap the error.
The best things in life are not things.
|
|
|
|