|
you can use the WinSOCK send() to send the BROWSEINFO structure, and use recv to recieve the BROWSEINFO structure from the server.
|
|
|
|
|
hi guys,
I have a doubt..
How to use VC++6.0(Unmanaged classes) in managed C++ Form application?
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
|
Managed C++ executables can have a mixture of native and managed classes. Those classes that are managed have to be prefixed with __gc. The other classes use C++ usual notation.
Be carefull when doing this in dll. Net framework 1.0 and 1.1 have a serious bug when working with mixed code in dlls (dlls may hang - it is called the mixed dll problem). But in executables you can safelly mix code if you take into account the differences between managed and native code.
|
|
|
|
|
I have done lots of reading on the .NET framework and managed C++ but haven't done any development with either. I'm primarily a C++/MFC 6.0 developer and do some ASP/web stuff aside. My web development will move towards ASP.NET. A decision that's a no-brainer to me because of all the benefits and enhancements that come with ASP.NET.
I'm looking for people's opinion on writing shrink wrapped software using MC++ (or C#) and the .NET framework. To do, or not to do? I'm quite stuck on which direction to go, managed code vs. native code, for my next shrink wrapped, desktop application? I don't want to move to .NET just because it's cutting edge, new and exciting.
I don't need any security features provided wit .NET, deployment isn't that difficult now anyway, I don't do mobile devices or multiple platforms, and integration with 3rd party applications is all done with delimited files. From a functional/security standpoint, there's little reason to move to .NET from what I can tell, other than possible productivity gains. Even with productivity gains, I have so much reusable C++/MFC code from other applications, I don't see enhanced productivity being that great.
I've read opinions that say to stay away from MC++ and go C# or VB.NET if developing under .NET. I've read opinions that say stay away from .NET with shrink wrapped, desktop software. Both opinions were shallow with little supporting arguments. I hope to get a more in depth discussion started here.
The fine print:
1) Should shrink wrapped, desktop software be developed using .NET? (i.e. apps like a text editor, graphics editor, or other file-based application.)
2) If so, should reusable C++ code be converted to MC++ or be rewritten using C# or VB.NET?
Thank you for your support. B&J
|
|
|
|
|
For all it is worth, I am a former developer of Microsoft Excel and am using C# to develop shrink-wrapped desktop software.
The plus:
1) Garbage collection reduces an entire class of errors
2) Performance is actually quite good. One thing that you often don't hear is that code written in C# can actually be faster than C++ in many cases because of
a) Extensive inlining,
b) use of the __fastcall convention,
c) ultrafast heap allocation
d) sizeable library
3) Very good exception handling
4) You are going to develop your software much faster
The one bad thing is the omission of some of the document infrastructure of MFC and the number of third-party support for MFC.
Thanks,
Wes
|
|
|
|
|
Please take a look at WTL. As for the argument of C# being faster, it depends on what you are doing - if you accessing database, the speed is actually not much dependent on the application but by the database provider access protocol and other factors.
I have just completed an MC++ GIS component, the GDI+ speed is so disappointing. However, using the direct COM version with GDI where necessary, I got a manageable speed.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul Selormey wrote:
I have just completed an MC++ GIS component
An article possibility??
-Nick Parker
|
|
|
|
|
Nick Parker wrote:
An article possibility??
It is a company work, however, I might find time to share some points and experience if this is what you mean.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul Selormey wrote:
It is a company work, however, I might find time to share some points and experience if this is what you mean.
It sounded interesting, sure, write something up.
-Nick Parker
|
|
|
|
|
Right, after my June holiday (going to Ghana-Africa to enjoy sunshine!) I will try to put something up.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul Selormey wrote:
going to Ghana-Africa to enjoy sunshine!
Enjoy and take it easy.
-Nick Parker
|
|
|
|
|
Hello everyone, I've been working with a developer of a commercial email component written in managed c++ for the past three weeks trying to pin down a problem.
We think we've found a bug in .net (problem happens with both 1.0 and 1.1). I would like to know if anyone has seen anything similar or heard of a bug that might be related to this. (I've scoured the net for weeks now but nothing)
Here are the details:
.Net reports a null reference exception very randomly and intermittently, (sometimes not for days, sometimes almost immediately when the test app is run) like this:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an
object.
at ClsEmail.Clone(ClsEmail* )
(truncated here)
The author of the component has kindly provided the source code to the function being called and his comments below it:
Email *EmailBundle::GetEmail(long index)
{
if (!m_bundle) return 0;
ClsEmail __nogc *e = m_bundle->GetEmail(index);
if (!e) return 0;
ClsEmail __nogc *e2 = e->Clone(); <---- Stack traceback indicates the failure is here
if (!e2) return 0;
Email *eTemp = new Email(e2);
return eTemp;
}
The stack traceback and error message indicate that "e" is not a valid
managed object, but e isn't a managed object in the first place.
The code that calls it is plain vanilla c# and can work for days or only minutes, it just loops and gets email from a server. The problem happens on both an XP Pro and a Windows 2000 server computer that are stripped bare test stations.
The component author is unable to reproduce the error, however I can reproduce it easily on test computers here and he has at least one other client that has reported the problem.
I really need this to work reliably for a project I'm working on. Problem is it works perfectly most of the time, then fails and it's an unattended mail server type program with remote users so it's disastrous when it fails.
Does anyone have any thoughts on this or has seen anything similar before?
(I have much more information but didn't want to post too much)
"Things are more like they are now than they ever were before."
-- Dwight Eisenhower
|
|
|
|
|
If m_bundle is a __gc class and you are referencing it with a __nogc pointer, garbage collection can move the pointed to memory at anytime. You need to use a pinned pointer.
ClsEmail __pin *e2 = e->Cloned();
The pinned pointer remains pinned until it goes out of scope or gets assigned a value of zero.
|
|
|
|
|
I asked the component author about something similar before, but I'll ask specifically about the point you raised, thank you for taking the time to look at it.
"Things are more like they are now than they ever were before."
-- Dwight Eisenhower
|
|
|
|
|
Author says m_bundle is a __nogc so that's not it I guess.
|
|
|
|
|
Strange! I suspect it is since it looks like it is using the Clone() method of the ICloneable interface. Since we cannot see under the covers, it's hard to determine what is going on.
|
|
|
|
|
Hmmm...you have a point there, I'll ask.
"Things are more like they are now than they ever were before."
-- Dwight Eisenhower
|
|
|
|
|
|
So, where is the managed code? Is everything unmanaged?
|
|
|
|
|
Hi im new to Managed C++
Can a anyone tell me how to convert String to int..
In native C++ we used atoi(CString) function.So in MC++ what should I use.
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
If you're using .NET string and int datatypes (internally the String and Int32 classes) you can use the Parse method of Int32 :
int nResult = 0;
String* pMyNumber = "15";
nResult = Int32::Parse( pMyNumber );
I've found that it's possible to cast between the CString and the .NET String datatypes without any trouble (at least I think I did -- was a while ago I last used MC++).
If not, I'm sure someone far more knowledgeable than me will be able to suggest exactly what you need to do
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
|
|
|
|
|
Hello All,
I have a project in MC++ consisting of several components/controls.
Many parts used indexed properties. These are recognized in VB.NET as properties, and shows in the VB.NET code browser as such.
However, in C#, the indexed properties are seen as methods;
get_Item/set_Item instead of the Item property in the following:
__property String __gc* get_Item(Int32 index)
{
}
__property void set_Item(Int32 index, String __gc* value)
{
}
Is this a known problem? is there anyway to work around it? It is
becoming very difficult to document our components.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi Paul
Put [ DefaultMember( "Item" ) ] before your class declaration
Regards,
Nish
p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same )
p.s. #2 - I posted this here too so you'll find it earlier
"I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies
My book :- Summer Love and Some more Cricket [New Win]
Review by Shog9 Click here for review[NW]
|
|
|
|
|
Thanks.
Nishant S wrote:
p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same )
Read that too. Andre claims it is a bug. It works with VB.NET without marking it as DefaultMember. I do not know when the MC++ team will have put a real working compiler for .NET - it is still too buggy
BTW, should it be DefaultMember or DefaultProperty?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|