|
How could it conceivably be faster, considering its a quasi-interpreted environment.
|
|
|
|
|
I don't believe .Net code is any faster than C++ one (I believe the contrary), albeit there is a strong controversy about. Anyway, for the average programmer, that is absolutely irrelevant. On the other hand, passing to .Net programming (on big projects and IMHO) may speed up noticeably coding activity and this usually matters.
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.
|
|
|
|
|
.Net Code is intrisically slower in almost everything except heap memory management. Because managed code uses the managed heap it can perform 10x faster than poorly written but otherwise similar C++/MFC code. However if speed is the issue you can ~always optimise the C++ code to end up faster than the best .Net equivalent.
The highly simplified version but basically sound version of things as far as I can tell is:-
It's a trade off between -
Moving to .Net makes poor-average MFC/C++ a lot - a bit faster.
Moving to .Net makes really good or really simple (i.e. very little heap usage) MFC/C++ code a bit slower.
You pays your money and you takes your choice
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: Net Code is intrisically slower in almost everything except heap memory management. Because managed code uses the managed heap it can perform 10x faster than poorly written but otherwise similar C++/MFC code.
Even that is questionable - CRT is much smarter than .NET marketing wants us to believe.
|
|
|
|
|
Sure it is smarter than the average bear but the CRT is also a catclysmic mess. Seven levels of function calls to do one allocation is already a high price to pay for a few bytes before you get into actual heap management. Granted it's not as bad in release code as the view you get in the debugger.
I wrote my own page memory manager that buy's pages off Win32 on a private heap and it beats the CRT by >10x in 1Gb of random <1MB size, allocations deleted in random order (Which is pretty much worst case for my implementation). <1s on an old Athlon 2100+. Doesn't suffer badly from fragmentation either .
It needs a hell of a lot more refining and tidying up before I post it to CP though and the average memory footprint at runtime is a little larger than with the CRT. Making that tunable is one of the refinements needed.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Electronic75 wrote: I specially want to know whether .Net is significantly faster than MFC
.NET is inherently slower than C++ (MFC or not) and, even worse, memory footprint of a .NET application is much bigger than the one of a similar C++ application.
|
|
|
|
|
|
CPallini wrote: Oh, where are you when some of CP gurus claimed, against my opinion, that C# was faster then C++, basing substantially their assumptions on a benchmark result?
Oh I believe it is possible to write a benchmark where C# would outperform C++. For instance, just use iostrem library a lot on C++ side, and here you are
|
|
|
|
|
Nemanja Trifunovic wrote: Oh I believe it is possible to write a benchmark where C# would outperform C++
I agree. Of course the proposed benchmark claimed to be a bit more general (if I remember well stressed on object creation/destruction)... But, again, unfortunately I can't remember the web page (maybe some of mentioned CP gurus remembers better than me).
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.
|
|
|
|
|
With your years of experience with MFC, who cares which is faster. C++ is the only language that
let's you leverage both lower level unmanaged C++ code and the rich .NET framework. You can
easily use your existing MFC code and add code that uses features of the .NET framework.
What is "fast" anyway?
When I first started adding managed code to a big multimedia-rich application I did a full
managed build. There was no perceivable difference in speed, with multiple audio and video
tracks capturing and playing. Note that I personally mix managed and unmanaged code - that first
full-managed build was specifically to test the speed because I was sceptical .
Maybe there's a performance hit when you run the app the first time and it gets JIT compiled, but
I've never noticed that either since most of my first runs are in the debugger, which is slow
anyway.
I have no idea why I responded to this question, but thanks for asking - the wide variety of
answers is always entertaining
As with any language or framework - use the best tool that provides the best solution for your
needs.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I'm currently loading a circular image onto a CBitmapButton which has the outside area of the bitmap coloured the same as the dialog so that the user is fooled into thinking it's a circular button. However the problem I have is that the user can still click on the part of the button that is outside of the circular bitmap.
One solution I found was when the button is clicked, get the mouse position and if it is outside of the circle then ignore the click, however and this is the tricky part, the button has two bitmaps associated to it (down and up) and these get processed before the ON_BN_CLICK event so the bitmap changes temporarily.
Here's what I want to happen:
User presses left mouse button down
Check that mouse pos is within circle
If mouse is within circle
load 'down' bitmap
User releases left mouse button
if mouse is within circle
load 'up' bitmap
do some clever stuff :laugh:
if conditions are met
load 'selected' bitmap
Looking at the button methods the only suitable one is the ON_BN_CLICK event but not a WM_LBUTTONDOWN event like on the dialog.
Does anyone have any ideas on how to do this? This is getting developed within Studio 2003 and is a Dialog based MFC app.
cheers,
Andy
|
|
|
|
|
There are several code project articles on irregularly shaped buttons. In general, SetWindowRgn is the Win SDK call you use to give any window (for example a button) an irregular shape. SetWindowRgn is acessible somehow through MFC, or if you're using managed code, thorugh that as well, I presume.
|
|
|
|
|
cheers, you were right, all I needed was:
HRGN rgn ;
m_MyButton.GetClientRect ( &button_rect ) ;
rgn = CreateEllipticRgn( 0, 0,
button_rect.Width(), button_rect.Height() );
int ret_val = m_MyButton.SetWindowRgn(rgn, true);
Andy,
|
|
|
|
|
So does your (round) bitmap touch the four sides of the bounding rectangle? What if your bitmap was an oval instead? Would CreateEllipticRgn() still work?
"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
|
|
|
|
|
Hello,
I'm trying to find a function where you could Copy a file from a UNC path to a UNC path and be able to supply the function with a domain\user and password. I have been searching MSDN for the past couple hours with no luck. I know if you simply supply a UNC path it will prompt for authentication but I want to automate this.
Thanks for any suggestions,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Create the connection between the two computers using NetUseAdd() , then call CopyFile() .
"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
|
|
|
|
|
Good idea, I was thinking about that earlier, but for some reason I thought you needed to assign a drive letter (which i didn't want to do) but i see now that you don't.
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hello All
I have downloaded a source code which has been developed in Win32. The source code has all the necessary resource files, .c and .h files and a makefile (.mk extension). But I would like to make a workspace (VC 6.0, dsw file) out of the available source files so that I can debug the code in VC 6.0. Is there a way to create a dsw file from the available files ? If Yes, can somebody help me out !!
Thanx.
|
|
|
|
|
vipin_nvk wrote: Is there a way to create a dsw file from the available files ? If Yes, can somebody help me out !!
Sure, you just need to know what type of project it is/was. Just use the AppWizard to create that type of project, and then add your files to 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
|
|
|
|
|
I am attempting to write a C++ application that can read data from an .STL file (such as volume, xyz values, etc.) I am having trouble with this task. Can anyone help? I've seen some freeware called Admesh. The Admesh software computes reads data only from simple .STL files, but cannot read a complex file. Any help would be appreciated.
rtprogrammer
|
|
|
|
|
If you want to read the file yourself, you have to know the file format and do everything yourself. An alternative would be to use a library (or existing source code) that do that for you (if you can find that).
For the file format, google is your friend[^]
|
|
|
|
|
I will try to implement your suggestion. Thanks for the info.
rtprogrammer
|
|
|
|
|
Hi all,
How can i create a window inside a dialog to display video
captured from any device attached to the system.For capturing and displaying i
will be using DirectShow.
Thanks and Regards,
Mayank
|
|
|
|
|
Download the Platform SDK (version Server 2003 R2 or newer) - the DirectShow SDK is included.
There's enough documentation and sample code there to get you started pretty quickly.
If you run into specific problems, don't hesitate to ask here
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I have an Object that hasn't the ON_INITMENU ...
and I want to disable the menu of it...
I tried to do that using HOOKs but I can't disable the Right-Click button
On the keyboard (next to Alt btn)
(The control is CHtmlEditCtrl2 in Design mode)
Please help me.
Thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|