|
that's right, they are not related pointer type.
|
|
|
|
|
Studio has gotten a lot more picky about this (and they should've been all along) but essentially what the error is telling you.
You defined a message catching method as:
afx_msg void OnChatAddSize(LPARAM lParam, WPARAM wParam);
but it expected (for ON_MESSAGE() ) a method call that would look like this:
afx_msg LRESULT OnChatAddSize(WPARAM wParam, LPARAM lParam)
So you essentially have to have the parameters be of the same type and order (WPARAM, LPARAM) and have return of type LRESULT and you'll make the compiler happy.
|
|
|
|
|
Hi i need code for displaying the utf8 text through mfc application.Please any one help me in this regard.
Regards
Kishore Kumar Dacha
|
|
|
|
|
Where do you want to display it? One of the printf() [^] or TextOut() [^] type routines should be able to handle it.
The best things in life are not things.
|
|
|
|
|
Hello,
I have a Windows Application with its own PlugIn-System. Each PlugIn is a typical Windows-Dll. All works fine so far.
The problem is that if a single PlugIn (for whatever reason) crashes, the whole application crashes too.
Its the same problem as FireFox and Flash-PlugIn, for example.
I wonder if someone has any idea how to catch such crashes in order to prevent the crashing of the main application.
Calling the PlugIn-Dll Functions from another process? If, how to communicate with the mainapp and vice versa?
Any ideas/help appreciated.
Nikolaus
|
|
|
|
|
You could look at using COM as your API mechanism; you can create inproc servers, and use them inproc for debugging and out of proc to air-gap your app from the faults
However, I'd suggest it would be far more effective fixing your broken code, than trying to implement a cute way to hide the problem
|
|
|
|
|
I am talking about external plugins. "third party modules" - if the problem/crash arises there, it can crash, but it should not affect the calling application.
|
|
|
|
|
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)
|
|
|
|