468,106 Members | 1,493 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,106 developers. It's quick & easy.

inline functions

Does C# inline functions? I do not see a inline keyword. Is there an
implicit inline? Can the compiler select functions for auto-inlining? I am
more used to C++ where all these things are possible.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
Nov 15 '05 #1
30 19264
The C# compiler does not inline functions. However, the .NET runtime/JIT is
allowed to inline functions, and often does.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Will Pittenger" <wi************@verizon.net> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
Does C# inline functions? I do not see a inline keyword. Is there an
implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are possible.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)

Nov 15 '05 #2
Just a quick note:

'inline' is ignored by many C and C++ compilers, as the compiler can
generally make a better decision about what to inline and what not to inline
than the programmer.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message
news:O9***************@TK2MSFTNGP12.phx.gbl...
The C# compiler does not inline functions. However, the .NET runtime/JIT is allowed to inline functions, and often does.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.

"Will Pittenger" <wi************@verizon.net> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
Does C# inline functions? I do not see a inline keyword. Is there an
implicit inline? Can the compiler select functions for auto-inlining?
I am
more used to C++ where all these things are possible.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)


Nov 15 '05 #3
JIT applies to all .NET assemblies, not just C#. Remember, .NET
is a system, C# is merely a language on top of it.

As far as C# being castrated, to me, it seems like has all the
good stuff and almost none of the bad of C++. To each his own,
I guess.

They're adding Generics in C# for .NET 2.0 which are similar
to Templates in C++.

As far as finding things C++ does better than .NET, you'll
have a hard time. In all but the most contrived ultra-performance
scenarios, .NET has many advantages over unmanaged C/C++ code.

Check this out:
http://tinyurl.com/3890 [MSDN article]

In many cases, because IL is JIT'd, it runs faster than
equivalent unmanaged code because the JIT can better determine
at run-time which optimizations will have the most impact.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Would JIT apply to a local executable? I do not anticipate doing any web stuff for a while. I am looking at doing some things that I think that C++ is better equipped for than C# (which seems to be castrated).
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message
news:O9***************@TK2MSFTNGP12.phx.gbl...
The C# compiler does not inline functions. However, the .NET
runtime/JIT is
allowed to inline functions, and often does.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.


"Will Pittenger" <wi************@verizon.net> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for

auto-inlining? I
am
more used to C++ where all these things are possible.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)



Nov 15 '05 #4
If you haven't prejitted your assembly with ngen.exe your assembly will be
jitted. The same for a web assembly.
Now why is C# castrated? It is the most beautiful OO language I've ever
seen. Using your analogy, you can see C++ as a transvestite ;).
Ask yourself, do you really want to think about whether a function should be
inlined or not? Well, I don't.

Greetz and good luck with your exploration,
-- Rob.

Will Pittenger wrote:
Would JIT apply to a local executable? I do not anticipate doing any
web stuff for a while. I am looking at doing some things that I
think that C++ is better equipped for than C# (which seems to be
castrated). ----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message
news:O9***************@TK2MSFTNGP12.phx.gbl...
The C# compiler does not inline functions. However, the .NET
runtime/JIT is allowed to inline functions, and often does.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Will Pittenger" <wi************@verizon.net> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
Does C# inline functions? I do not see a inline keyword. Is there
an implicit inline? Can the compiler select functions for
auto-inlining? I am more used to C++ where all these things are
possible. ----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)

Nov 15 '05 #5
Great. How should I call functions in a MFC extension library. Such a
library might have functions taking as parameters and/or returning CStrings
and CWnds. (Or for that matter a generic C++ style class.) What would be
the equivalent of pure virtual functions and multiple derivation? I am
sorry, but the jury is still out.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:AK*********************@twister.austin.rr.com ...
JIT applies to all .NET assemblies, not just C#. Remember, .NET
is a system, C# is merely a language on top of it.

As far as C# being castrated, to me, it seems like has all the
good stuff and almost none of the bad of C++. To each his own,
I guess.

They're adding Generics in C# for .NET 2.0 which are similar
to Templates in C++.

As far as finding things C++ does better than .NET, you'll
have a hard time. In all but the most contrived ultra-performance
scenarios, .NET has many advantages over unmanaged C/C++ code.

Check this out:
http://tinyurl.com/3890 [MSDN article]

In many cases, because IL is JIT'd, it runs faster than
equivalent unmanaged code because the JIT can better determine
at run-time which optimizations will have the most impact.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Would JIT apply to a local executable? I do not anticipate doing any

web
stuff for a while. I am looking at doing some things that I think

that C++
is better equipped for than C# (which seems to be castrated).
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message
news:O9***************@TK2MSFTNGP12.phx.gbl...
The C# compiler does not inline functions. However, the .NET runtime/JIT
is
allowed to inline functions, and often does.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no

rights.


"Will Pittenger" <wi************@verizon.net> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
> Does C# inline functions? I do not see a inline keyword. Is

there an > implicit inline? Can the compiler select functions for

auto-inlining?
I
am
> more used to C++ where all these things are possible.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
>
>



Nov 15 '05 #6
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
How should I call functions in a MFC extension library
That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.
What would be the equivalent of pure virtual functions


Abstract classes and methods
and multiple derivation


Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
Great. How should I call functions in a MFC extension library. Such a
library might have functions taking as parameters and/or returning CStrings
and CWnds. (Or for that matter a generic C++ style class.) What

would be
the equivalent of pure virtual functions and multiple derivation? I

am
sorry, but the jury is still out.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:AK*********************@twister.austin.rr.com ...
JIT applies to all .NET assemblies, not just C#. Remember, .NET
is a system, C# is merely a language on top of it.

As far as C# being castrated, to me, it seems like has all the
good stuff and almost none of the bad of C++. To each his own,
I guess.

They're adding Generics in C# for .NET 2.0 which are similar
to Templates in C++.

As far as finding things C++ does better than .NET, you'll
have a hard time. In all but the most contrived ultra-performance
scenarios, .NET has many advantages over unmanaged C/C++ code.

Check this out:
http://tinyurl.com/3890 [MSDN article]

In many cases, because IL is JIT'd, it runs faster than
equivalent unmanaged code because the JIT can better determine
at run-time which optimizations will have the most impact.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Would JIT apply to a local executable? I do not anticipate doing any web
> stuff for a while. I am looking at doing some things that I
think that C++
> is better equipped for than C# (which seems to be castrated).
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
message > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > The C# compiler does not inline functions. However, the .NET
runtime/JIT
> is
> > allowed to inline functions, and often does.
> >
> > --
> > --Grant
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > Does C# inline functions? I do not see a inline keyword.

Is there an
> > > implicit inline? Can the compiler select functions for
auto-inlining?
> I
> > am
> > > more used to C++ where all these things are possible.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > >
> > >
> >
> >
>
>



Nov 15 '05 #7
The scenario that I had in mind was you have to use a DLL that is already on
a user's machine. You are required to coexist with a larger and older MFC
based program. Most of what you need is in one of its DLLs. Perhaps that
DLL has tools for accessing a file format that you have no control or
knowledge of. I have had to put up with that many times. Good luck.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
How should I call functions in a MFC extension library


That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.
What would be the equivalent of pure virtual functions


Abstract classes and methods
and multiple derivation


Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
Great. How should I call functions in a MFC extension library. Such
a
library might have functions taking as parameters and/or returning

CStrings
and CWnds. (Or for that matter a generic C++ style class.) What

would be
the equivalent of pure virtual functions and multiple derivation? I

am
sorry, but the jury is still out.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:AK*********************@twister.austin.rr.com ...
> JIT applies to all .NET assemblies, not just C#. Remember, .NET
> is a system, C# is merely a language on top of it.
>
> As far as C# being castrated, to me, it seems like has all the
> good stuff and almost none of the bad of C++. To each his own,
> I guess.
>
> They're adding Generics in C# for .NET 2.0 which are similar
> to Templates in C++.
>
> As far as finding things C++ does better than .NET, you'll
> have a hard time. In all but the most contrived ultra-performance
> scenarios, .NET has many advantages over unmanaged C/C++ code.
>
> Check this out:
> http://tinyurl.com/3890 [MSDN article]
>
> In many cases, because IL is JIT'd, it runs faster than
> equivalent unmanaged code because the JIT can better determine
> at run-time which optimizations will have the most impact.
>
> -c
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:%2****************@tk2msftngp13.phx.gbl...
> > Would JIT apply to a local executable? I do not anticipate

doing
any
> web
> > stuff for a while. I am looking at doing some things that I

think > that C++
> > is better equipped for than C# (which seems to be castrated).
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in

message
> > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > The C# compiler does not inline functions. However, the .NET
> runtime/JIT
> > is
> > > allowed to inline functions, and often does.
> > >
> > > --
> > > --Grant
> > > This posting is provided "AS IS" with no warranties, and confers
no
> > rights.
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > Does C# inline functions? I do not see a inline keyword.

Is > there an
> > > > implicit inline? Can the compiler select functions for
> auto-inlining?
> > I
> > > am
> > > > more used to C++ where all these things are possible.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #8
Almost forgot. CDC provides THREE members which draw 3D edges and/or
rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already on a user's machine. You are required to coexist with a larger and older MFC
based program. Most of what you need is in one of its DLLs. Perhaps that
DLL has tools for accessing a file format that you have no control or
knowledge of. I have had to put up with that many times. Good luck.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
>How should I call functions in a MFC extension library

That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.

> What would be the equivalent of pure virtual functions

Abstract classes and methods

> and multiple derivation

Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
> Great. How should I call functions in a MFC extension library.

Such
a
> library might have functions taking as parameters and/or returning
CStrings
> and CWnds. (Or for that matter a generic C++ style class.) What
would be
> the equivalent of pure virtual functions and multiple derivation? I
am
> sorry, but the jury is still out.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:AK*********************@twister.austin.rr.com ...
> > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > is a system, C# is merely a language on top of it.
> >
> > As far as C# being castrated, to me, it seems like has all the
> > good stuff and almost none of the bad of C++. To each his own,
> > I guess.
> >
> > They're adding Generics in C# for .NET 2.0 which are similar
> > to Templates in C++.
> >
> > As far as finding things C++ does better than .NET, you'll
> > have a hard time. In all but the most contrived ultra-performance
> > scenarios, .NET has many advantages over unmanaged C/C++ code.
> >
> > Check this out:
> > http://tinyurl.com/3890 [MSDN article]
> >
> > In many cases, because IL is JIT'd, it runs faster than
> > equivalent unmanaged code because the JIT can better determine
> > at run-time which optimizations will have the most impact.
> >
> > -c
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > Would JIT apply to a local executable? I do not anticipate

doing
any
> > web
> > > stuff for a while. I am looking at doing some things that I

think
> > that C++
> > > is better equipped for than C# (which seems to be castrated).
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
message
> > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > The C# compiler does not inline functions. However, the .NET
> > runtime/JIT
> > > is
> > > > allowed to inline functions, and often does.
> > > >
> > > > --
> > > > --Grant
> > > > This posting is provided "AS IS" with no warranties, and

confers
no
> > > rights.
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > Does C# inline functions? I do not see a inline keyword.

Is
> > there an
> > > > > implicit inline? Can the compiler select functions for
> > auto-inlining?
> > > I
> > > > am
> > > > > more used to C++ where all these things are possible.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #9
A small MEC++ assembly could wrap this for you. It might be
possible to consume MFC classes from C#, I'm not sure, I haven't
had much experience in that realm.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already on a user's machine. You are required to coexist with a larger and older MFC based program. Most of what you need is in one of its DLLs. Perhaps that DLL has tools for accessing a file format that you have no control or
knowledge of. I have had to put up with that many times. Good luck.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
>How should I call functions in a MFC extension library

That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.

> What would be the equivalent of pure virtual functions

Abstract classes and methods

> and multiple derivation

Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
> Great. How should I call functions in a MFC extension library.

Such
a
> library might have functions taking as parameters and/or returning CStrings
> and CWnds. (Or for that matter a generic C++ style class.) What would be
> the equivalent of pure virtual functions and multiple derivation? I am
> sorry, but the jury is still out.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:AK*********************@twister.austin.rr.com ...
> > JIT applies to all .NET assemblies, not just C#. Remember, ..NET > > is a system, C# is merely a language on top of it.
> >
> > As far as C# being castrated, to me, it seems like has all the
> > good stuff and almost none of the bad of C++. To each his own,
> > I guess.
> >
> > They're adding Generics in C# for .NET 2.0 which are similar
> > to Templates in C++.
> >
> > As far as finding things C++ does better than .NET, you'll
> > have a hard time. In all but the most contrived ultra-performance > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> >
> > Check this out:
> > http://tinyurl.com/3890 [MSDN article]
> >
> > In many cases, because IL is JIT'd, it runs faster than
> > equivalent unmanaged code because the JIT can better determine
> > at run-time which optimizations will have the most impact.
> >
> > -c
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > Would JIT apply to a local executable? I do not anticipate

doing
any
> > web
> > > stuff for a while. I am looking at doing some things that I

think
> > that C++
> > > is better equipped for than C# (which seems to be castrated). > > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
message
> > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > The C# compiler does not inline functions. However, the ..NET > > runtime/JIT
> > > is
> > > > allowed to inline functions, and often does.
> > > >
> > > > --
> > > > --Grant
> > > > This posting is provided "AS IS" with no warranties, and

confers
no
> > > rights.
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > Does C# inline functions? I do not see a inline
keyword. Is
> > there an
> > > > > implicit inline? Can the compiler select functions for
> > auto-inlining?
> > > I
> > > > am
> > > > > more used to C++ where all these things are possible.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #10
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or
rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already
on
a user's machine. You are required to coexist with a larger and

older MFC based program. Most of what you need is in one of its DLLs. Perhaps that DLL has tools for accessing a file format that you have no control or knowledge of. I have had to put up with that many times. Good luck. ----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
> >How should I call functions in a MFC extension library
>
> That's difficult, but if it's a COM interface, it can be done.
> Otherwise, you'll have to use Managed Extensions for C++ to make
> a wrapper.
>
> That's not a fair criticism of C#, really, because you can't
> use .NET assemblies in C++ either.
>
> > What would be the equivalent of pure virtual functions
>
> Abstract classes and methods
>
> > and multiple derivation
>
> Multiple inheritence, you mean? There was a concious decision
> not to support MI in .NET because ... well, that's a very long
> debate, but it's not because they couldn't do it, it's because
> they didn't want to do it and felt it was wrong to do it.
>
> Let's turn the tables...
>
> What if I wanted didn't want to do any of my memory management
> in C++?
>
> What if I wanted to have a comprehensive framework library with
> nearly everything you could want built in and supported by
> the runtime and compiler?
>
> What if I wanted to make my code cross-platform without any
> fancy magic or special #defines?
>
> What if I wanted a pure OO language without any legacy
> baggage?
>
> -c
>
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:u9****************@TK2MSFTNGP09.phx.gbl...
> > Great. How should I call functions in a MFC extension library. Such
> a
> > library might have functions taking as parameters and/or returning > CStrings
> > and CWnds. (Or for that matter a generic C++ style class.) What > would be
> > the equivalent of pure virtual functions and multiple derivation? I > am
> > sorry, but the jury is still out.
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:AK*********************@twister.austin.rr.com ...
> > > JIT applies to all .NET assemblies, not just C#. Remember, ..NET > > > is a system, C# is merely a language on top of it.
> > >
> > > As far as C# being castrated, to me, it seems like has all the > > > good stuff and almost none of the bad of C++. To each his own, > > > I guess.
> > >
> > > They're adding Generics in C# for .NET 2.0 which are similar
> > > to Templates in C++.
> > >
> > > As far as finding things C++ does better than .NET, you'll
> > > have a hard time. In all but the most contrived ultra-performance > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > >
> > > Check this out:
> > > http://tinyurl.com/3890 [MSDN article]
> > >
> > > In many cases, because IL is JIT'd, it runs faster than
> > > equivalent unmanaged code because the JIT can better determine > > > at run-time which optimizations will have the most impact.
> > >
> > > -c
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > Would JIT apply to a local executable? I do not anticipate doing
> any
> > > web
> > > > stuff for a while. I am looking at doing some things that I think
> > > that C++
> > > > is better equipped for than C# (which seems to be castrated). > > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > message
> > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > The C# compiler does not inline functions. However, the ..NET > > > runtime/JIT
> > > > is
> > > > > allowed to inline functions, and often does.
> > > > >
> > > > > --
> > > > > --Grant
> > > > > This posting is provided "AS IS" with no warranties, and
confers
> no
> > > > rights.
> > > > >
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > Does C# inline functions? I do not see a inline keyword. Is
> > > there an
> > > > > > implicit inline? Can the compiler select functions for > > > auto-inlining?
> > > > I
> > > > > am
> > > > > > more used to C++ where all these things are possible.
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #11
Real answers. Finally.

BTW: The scenario that I mentioned was hypothetical. I have been
programming many years to know that I always have to keep my options open.
In general, if that DLL was going to be out there anyway, and reproducing it
in C# would take too long, the DLL would be used. If that made C++ more
convenient, tough luck to those who favor C#. By the time a wrapper DLL
(based on what I think would be involved in wrapping the MFC classes and MFC
style classes in COM interfaces) could be written, some projects that I have
seen could probably be written in from scratch in C++.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
Will,
Most of the 3d edges and/or rectangles functions are in the
System.Windows.Forms.ControlPaint class.

I would recommend considering creating a Managed wrapper for your MFC legacy DLL. Something along the lines of:
http://msdn.microsoft.com/library/de...extensions.asp
Hope this helps
Jay

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or
rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already
on
a user's machine. You are required to coexist with a larger and older
MFC based program. Most of what you need is in one of its DLLs. Perhaps that DLL has tools for accessing a file format that you have no control or
knowledge of. I have had to put up with that many times. Good luck.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
> Oh yeah, one other thing... why on EARTH would you want to use
> MFC when you have .NET now? I can't even fathom the concept...!!
>
> :)
>
> -c
>
>
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:Z8*********************@twister.austin.rr.com ...
> > >How should I call functions in a MFC extension library
> >
> > That's difficult, but if it's a COM interface, it can be done.
> > Otherwise, you'll have to use Managed Extensions for C++ to make
> > a wrapper.
> >
> > That's not a fair criticism of C#, really, because you can't
> > use .NET assemblies in C++ either.
> >
> > > What would be the equivalent of pure virtual functions
> >
> > Abstract classes and methods
> >
> > > and multiple derivation
> >
> > Multiple inheritence, you mean? There was a concious decision
> > not to support MI in .NET because ... well, that's a very long
> > debate, but it's not because they couldn't do it, it's because
> > they didn't want to do it and felt it was wrong to do it.
> >
> > Let's turn the tables...
> >
> > What if I wanted didn't want to do any of my memory management
> > in C++?
> >
> > What if I wanted to have a comprehensive framework library with
> > nearly everything you could want built in and supported by
> > the runtime and compiler?
> >
> > What if I wanted to make my code cross-platform without any
> > fancy magic or special #defines?
> >
> > What if I wanted a pure OO language without any legacy
> > baggage?
> >
> > -c
> >
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > Great. How should I call functions in a MFC extension library.
> Such
> > a
> > > library might have functions taking as parameters and/or returning > > CStrings
> > > and CWnds. (Or for that matter a generic C++ style class.) What > > would be
> > > the equivalent of pure virtual functions and multiple derivation? I
> > am
> > > sorry, but the jury is still out.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:AK*********************@twister.austin.rr.com ...
> > > > JIT applies to all .NET assemblies, not just C#. Remember,
..NET > > > > is a system, C# is merely a language on top of it.
> > > >
> > > > As far as C# being castrated, to me, it seems like has all the
> > > > good stuff and almost none of the bad of C++. To each his own,
> > > > I guess.
> > > >
> > > > They're adding Generics in C# for .NET 2.0 which are similar
> > > > to Templates in C++.
> > > >
> > > > As far as finding things C++ does better than .NET, you'll
> > > > have a hard time. In all but the most contrived

ultra-performance > > > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> > > >
> > > > Check this out:
> > > > http://tinyurl.com/3890 [MSDN article]
> > > >
> > > > In many cases, because IL is JIT'd, it runs faster than
> > > > equivalent unmanaged code because the JIT can better determine
> > > > at run-time which optimizations will have the most impact.
> > > >
> > > > -c
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > Would JIT apply to a local executable? I do not anticipate
> doing
> > any
> > > > web
> > > > > stuff for a while. I am looking at doing some things that I
> think
> > > > that C++
> > > > > is better equipped for than C# (which seems to be castrated). > > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> > message
> > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > The C# compiler does not inline functions. However, the .NET > > > > runtime/JIT
> > > > > is
> > > > > > allowed to inline functions, and often does.
> > > > > >
> > > > > > --
> > > > > > --Grant
> > > > > > This posting is provided "AS IS" with no warranties, and
> confers
> > no
> > > > > rights.
> > > > > >
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > Does C# inline functions? I do not see a inline keyword. > Is
> > > > there an
> > > > > > > implicit inline? Can the compiler select functions for
> > > > auto-inlining?
> > > > > I
> > > > > > am
> > > > > > > more used to C++ where all these things are possible.
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #12
Why get DirectX or OpenGL in involved to just a bunch of button and other
control classes? Besides, DrawFrameControl uses the same Windows code that
Windows itself uses to draw caption bar buttons, radio buttons, scrollbars,
and more. (The control's WM_PAINT handler calls DrawFrameControl.) That
means that if your control uses DrawFrameControl for objects that look like
buttons, they will look like buttons regardless of which Windows version you
are on. You might have written a button class that displays graphics for
Windows 3.1 and it would look like a Windows 3.1 button until you ran the
program under Windows 9x. Then Windows would make your button look like a
Windows 9x button. If you later provided a manifest, you could skin your
button -- with no code. All you would ever paint is the graphic. That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you draw the
drop border you need for custom edit box-like areas. DrawEdge (MFC and GDI)
is what you would use if you wanted a group box style etched (or raised)
line, or a diagonal 3d line. I think that Jay Harlow provided what I was
looking for. DirectX and OpenGL sound like the sledge hammer providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or
rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already
on
a user's machine. You are required to coexist with a larger and

older MFC based program. Most of what you need is in one of its DLLs. Perhaps that DLL has tools for accessing a file format that you have no control or knowledge of. I have had to put up with that many times. Good luck. ----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
> Oh yeah, one other thing... why on EARTH would you want to use
> MFC when you have .NET now? I can't even fathom the concept...!!
>
> :)
>
> -c
>
>
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:Z8*********************@twister.austin.rr.com ...
> > >How should I call functions in a MFC extension library
> >
> > That's difficult, but if it's a COM interface, it can be done.
> > Otherwise, you'll have to use Managed Extensions for C++ to make
> > a wrapper.
> >
> > That's not a fair criticism of C#, really, because you can't
> > use .NET assemblies in C++ either.
> >
> > > What would be the equivalent of pure virtual functions
> >
> > Abstract classes and methods
> >
> > > and multiple derivation
> >
> > Multiple inheritence, you mean? There was a concious decision
> > not to support MI in .NET because ... well, that's a very long
> > debate, but it's not because they couldn't do it, it's because
> > they didn't want to do it and felt it was wrong to do it.
> >
> > Let's turn the tables...
> >
> > What if I wanted didn't want to do any of my memory management
> > in C++?
> >
> > What if I wanted to have a comprehensive framework library with
> > nearly everything you could want built in and supported by
> > the runtime and compiler?
> >
> > What if I wanted to make my code cross-platform without any
> > fancy magic or special #defines?
> >
> > What if I wanted a pure OO language without any legacy
> > baggage?
> >
> > -c
> >
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > Great. How should I call functions in a MFC extension library. > Such
> > a
> > > library might have functions taking as parameters and/or returning > > CStrings
> > > and CWnds. (Or for that matter a generic C++ style class.) What > > would be
> > > the equivalent of pure virtual functions and multiple derivation? I > > am
> > > sorry, but the jury is still out.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:AK*********************@twister.austin.rr.com ...
> > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET > > > > is a system, C# is merely a language on top of it.
> > > >
> > > > As far as C# being castrated, to me, it seems like has all the > > > > good stuff and almost none of the bad of C++. To each his own, > > > > I guess.
> > > >
> > > > They're adding Generics in C# for .NET 2.0 which are similar
> > > > to Templates in C++.
> > > >
> > > > As far as finding things C++ does better than .NET, you'll
> > > > have a hard time. In all but the most contrived ultra-performance > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > >
> > > > Check this out:
> > > > http://tinyurl.com/3890 [MSDN article]
> > > >
> > > > In many cases, because IL is JIT'd, it runs faster than
> > > > equivalent unmanaged code because the JIT can better determine > > > > at run-time which optimizations will have the most impact.
> > > >
> > > > -c
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > Would JIT apply to a local executable? I do not anticipate > doing
> > any
> > > > web
> > > > > stuff for a while. I am looking at doing some things that I > think
> > > > that C++
> > > > > is better equipped for than C# (which seems to be castrated). > > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > message
> > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > The C# compiler does not inline functions. However, the .NET > > > > runtime/JIT
> > > > > is
> > > > > > allowed to inline functions, and often does.
> > > > > >
> > > > > > --
> > > > > > --Grant
> > > > > > This posting is provided "AS IS" with no warranties, and
> confers
> > no
> > > > > rights.
> > > > > >
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > Does C# inline functions? I do not see a inline keyword. > Is
> > > > there an
> > > > > > > implicit inline? Can the compiler select functions for > > > > auto-inlining?
> > > > > I
> > > > > > am
> > > > > > > more used to C++ where all these things are possible.
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #13
Choosing your entire application's framework based on the
usage of one legacy DLL seems rather hasty.

A wrapper DLL in MEC++ wouldn't be that difficult. In fact,
the .NET part is simple, it's the unmanaged side that would
be difficult.

And no, it's not wrapping MFC with COM, it'd be creating
a small .NET class in C++ w/Managed Extensions to allow you
to call into the MFC class. It's like a small bridge class,
nothing fancy.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
Real answers. Finally.

BTW: The scenario that I mentioned was hypothetical. I have been
programming many years to know that I always have to keep my options open. In general, if that DLL was going to be out there anyway, and reproducing it in C# would take too long, the DLL would be used. If that made C++ more convenient, tough luck to those who favor C#. By the time a wrapper DLL (based on what I think would be involved in wrapping the MFC classes and MFC style classes in COM interfaces) could be written, some projects that I have seen could probably be written in from scratch in C++.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:OJ**************@TK2MSFTNGP09.phx.gbl...
Will,
Most of the 3d edges and/or rectangles functions are in the
System.Windows.Forms.ControlPaint class.

I would recommend considering creating a Managed wrapper for your MFC
legacy
DLL. Something along the lines of:

http://msdn.microsoft.com/library/de...extensions.asp

Hope this helps
Jay

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
> The scenario that I had in mind was you have to use a DLL that is
already
on
> a user's machine. You are required to coexist with a larger and
older MFC
> based program. Most of what you need is in one of its DLLs.
Perhaps that
> DLL has tools for accessing a file format that you have no
control or > knowledge of. I have had to put up with that many times. Good luck. > ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:hh*********************@twister.austin.rr.com ...
> > Oh yeah, one other thing... why on EARTH would you want to use
> > MFC when you have .NET now? I can't even fathom the concept...!! > >
> > :)
> >
> > -c
> >
> >
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:Z8*********************@twister.austin.rr.com ...
> > > >How should I call functions in a MFC extension library
> > >
> > > That's difficult, but if it's a COM interface, it can be done. > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > a wrapper.
> > >
> > > That's not a fair criticism of C#, really, because you can't
> > > use .NET assemblies in C++ either.
> > >
> > > > What would be the equivalent of pure virtual functions
> > >
> > > Abstract classes and methods
> > >
> > > > and multiple derivation
> > >
> > > Multiple inheritence, you mean? There was a concious decision > > > not to support MI in .NET because ... well, that's a very long > > > debate, but it's not because they couldn't do it, it's because > > > they didn't want to do it and felt it was wrong to do it.
> > >
> > > Let's turn the tables...
> > >
> > > What if I wanted didn't want to do any of my memory management > > > in C++?
> > >
> > > What if I wanted to have a comprehensive framework library with > > > nearly everything you could want built in and supported by
> > > the runtime and compiler?
> > >
> > > What if I wanted to make my code cross-platform without any
> > > fancy magic or special #defines?
> > >
> > > What if I wanted a pure OO language without any legacy
> > > baggage?
> > >
> > > -c
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > Great. How should I call functions in a MFC extension library. > > Such
> > > a
> > > > library might have functions taking as parameters and/or

returning > > > CStrings
> > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > would be
> > > > the equivalent of pure virtual functions and multiple derivation?
I
> > > am
> > > > sorry, but the jury is still out.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in
message > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET > > > > > is a system, C# is merely a language on top of it.
> > > > >
> > > > > As far as C# being castrated, to me, it seems like has
all the > > > > > good stuff and almost none of the bad of C++. To each his own, > > > > > I guess.
> > > > >
> > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > to Templates in C++.
> > > > >
> > > > > As far as finding things C++ does better than .NET, you'll > > > > > have a hard time. In all but the most contrived

ultra-performance
> > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > > >
> > > > > Check this out:
> > > > > http://tinyurl.com/3890 [MSDN article]
> > > > >
> > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > equivalent unmanaged code because the JIT can better determine > > > > > at run-time which optimizations will have the most impact. > > > > >
> > > > > -c
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > Would JIT apply to a local executable? I do not anticipate > > doing
> > > any
> > > > > web
> > > > > > stuff for a while. I am looking at doing some things that I > > think
> > > > > that C++
> > > > > > is better equipped for than C# (which seems to be

castrated). > > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > > message
> > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > The C# compiler does not inline functions. However, the .NET
> > > > > runtime/JIT
> > > > > > is
> > > > > > > allowed to inline functions, and often does.
> > > > > > >
> > > > > > > --
> > > > > > > --Grant
> > > > > > > This posting is provided "AS IS" with no warranties,
and > > confers
> > > no
> > > > > > rights.
> > > > > > >
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in
message
> > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > Does C# inline functions? I do not see a inline

keyword. > > Is
> > > > > there an
> > > > > > > > implicit inline? Can the compiler select

functions for > > > > > auto-inlining?
> > > > > > I
> > > > > > > am
> > > > > > > > more used to C++ where all these things are possible. > > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #14
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and other control classes? Besides, DrawFrameControl uses the same Windows code that Windows itself uses to draw caption bar buttons, radio buttons, scrollbars, and more. (The control's WM_PAINT handler calls DrawFrameControl.) That means that if your control uses DrawFrameControl for objects that look like buttons, they will look like buttons regardless of which Windows version you are on. You might have written a button class that displays graphics for Windows 3.1 and it would look like a Windows 3.1 button until you ran the program under Windows 9x. Then Windows would make your button look like a Windows 9x button. If you later provided a manifest, you could skin your button -- with no code. All you would ever paint is the graphic. That is what you use DrawFrameControl for. Draw3dRect (MFC only) lets you draw the drop border you need for custom edit box-like areas. DrawEdge (MFC and GDI) is what you would use if you wanted a group box style etched (or raised) line, or a diagonal 3d line. I think that Jay Harlow provided what I was looking for. DirectX and OpenGL sound like the sledge hammer providing a slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
> The scenario that I had in mind was you have to use a DLL that is
already
on
> a user's machine. You are required to coexist with a larger and

older MFC
> based program. Most of what you need is in one of its DLLs.

Perhaps that
> DLL has tools for accessing a file format that you have no
control or
> knowledge of. I have had to put up with that many times. Good

luck.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:hh*********************@twister.austin.rr.com ...
> > Oh yeah, one other thing... why on EARTH would you want to use
> > MFC when you have .NET now? I can't even fathom the
concept...!! > >
> > :)
> >
> > -c
> >
> >
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:Z8*********************@twister.austin.rr.com ...
> > > >How should I call functions in a MFC extension library
> > >
> > > That's difficult, but if it's a COM interface, it can be done. > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > a wrapper.
> > >
> > > That's not a fair criticism of C#, really, because you can't
> > > use .NET assemblies in C++ either.
> > >
> > > > What would be the equivalent of pure virtual functions
> > >
> > > Abstract classes and methods
> > >
> > > > and multiple derivation
> > >
> > > Multiple inheritence, you mean? There was a concious decision > > > not to support MI in .NET because ... well, that's a very long > > > debate, but it's not because they couldn't do it, it's because > > > they didn't want to do it and felt it was wrong to do it.
> > >
> > > Let's turn the tables...
> > >
> > > What if I wanted didn't want to do any of my memory management > > > in C++?
> > >
> > > What if I wanted to have a comprehensive framework library with > > > nearly everything you could want built in and supported by
> > > the runtime and compiler?
> > >
> > > What if I wanted to make my code cross-platform without any
> > > fancy magic or special #defines?
> > >
> > > What if I wanted a pure OO language without any legacy
> > > baggage?
> > >
> > > -c
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > Great. How should I call functions in a MFC extension

library.
> > Such
> > > a
> > > > library might have functions taking as parameters and/or

returning
> > > CStrings
> > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > would be
> > > > the equivalent of pure virtual functions and multiple

derivation? I
> > > am
> > > > sorry, but the jury is still out.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in
message > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > > > > is a system, C# is merely a language on top of it.
> > > > >
> > > > > As far as C# being castrated, to me, it seems like has
all the
> > > > > good stuff and almost none of the bad of C++. To each
his own,
> > > > > I guess.
> > > > >
> > > > > They're adding Generics in C# for .NET 2.0 which are
similar > > > > > to Templates in C++.
> > > > >
> > > > > As far as finding things C++ does better than .NET, you'll > > > > > have a hard time. In all but the most contrived

ultra-performance
> > > > > scenarios, .NET has many advantages over unmanaged C/C++

code.
> > > > >
> > > > > Check this out:
> > > > > http://tinyurl.com/3890 [MSDN article]
> > > > >
> > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > equivalent unmanaged code because the JIT can better

determine
> > > > > at run-time which optimizations will have the most impact. > > > > >
> > > > > -c
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message
> > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > Would JIT apply to a local executable? I do not

anticipate
> > doing
> > > any
> > > > > web
> > > > > > stuff for a while. I am looking at doing some things that I
> > think
> > > > > that C++
> > > > > > is better equipped for than C# (which seems to be

castrated).
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com>
wrote in
> > > message
> > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > The C# compiler does not inline functions. However,
the .NET
> > > > > runtime/JIT
> > > > > > is
> > > > > > > allowed to inline functions, and often does.
> > > > > > >
> > > > > > > --
> > > > > > > --Grant
> > > > > > > This posting is provided "AS IS" with no warranties,
and > > confers
> > > no
> > > > > > rights.
> > > > > > >
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > Does C# inline functions? I do not see a inline

keyword.
> > Is
> > > > > there an
> > > > > > > > implicit inline? Can the compiler select
functions for
> > > > > auto-inlining?
> > > > > > I
> > > > > > > am
> > > > > > > > more used to C++ where all these things are

possible. > > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #15
> So if you can do it through GDI, then you can do it in Win32.

I mean "then you can do it in .NET", sorry.

-Chad
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:aS*********************@twister.austin.rr.com ...
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and other
control classes? Besides, DrawFrameControl uses the same Windows code that
Windows itself uses to draw caption bar buttons, radio buttons, scrollbars,
and more. (The control's WM_PAINT handler calls DrawFrameControl.)

That
means that if your control uses DrawFrameControl for objects that

look like
buttons, they will look like buttons regardless of which Windows version you
are on. You might have written a button class that displays

graphics for
Windows 3.1 and it would look like a Windows 3.1 button until you
ran the
program under Windows 9x. Then Windows would make your button look like a
Windows 9x button. If you later provided a manifest, you could skin

your
button -- with no code. All you would ever paint is the graphic.

That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you

draw the
drop border you need for custom edit box-like areas. DrawEdge (MFC

and GDI)
is what you would use if you wanted a group box style etched (or

raised)
line, or a diagonal 3d line. I think that Jay Harlow provided what

I was
looking for. DirectX and OpenGL sound like the sledge hammer providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
> Almost forgot. CDC provides THREE members which draw 3D edges

and/or > rectangles. How many does Graphics in C# provide? I see none.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:eb**************@TK2MSFTNGP09.phx.gbl...
> > The scenario that I had in mind was you have to use a DLL that is already
> on
> > a user's machine. You are required to coexist with a larger and older MFC
> > based program. Most of what you need is in one of its DLLs.
Perhaps that
> > DLL has tools for accessing a file format that you have no control or
> > knowledge of. I have had to put up with that many times. Good luck.
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:hh*********************@twister.austin.rr.com ...
> > > Oh yeah, one other thing... why on EARTH would you want to use > > > MFC when you have .NET now? I can't even fathom the concept...!! > > >
> > > :)
> > >
> > > -c
> > >
> > >
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > news:Z8*********************@twister.austin.rr.com ...
> > > > >How should I call functions in a MFC extension library
> > > >
> > > > That's difficult, but if it's a COM interface, it can be done. > > > > Otherwise, you'll have to use Managed Extensions for C++ to make
> > > > a wrapper.
> > > >
> > > > That's not a fair criticism of C#, really, because you
can't > > > > use .NET assemblies in C++ either.
> > > >
> > > > > What would be the equivalent of pure virtual functions
> > > >
> > > > Abstract classes and methods
> > > >
> > > > > and multiple derivation
> > > >
> > > > Multiple inheritence, you mean? There was a concious
decision > > > > not to support MI in .NET because ... well, that's a very long > > > > debate, but it's not because they couldn't do it, it's because > > > > they didn't want to do it and felt it was wrong to do it.
> > > >
> > > > Let's turn the tables...
> > > >
> > > > What if I wanted didn't want to do any of my memory management > > > > in C++?
> > > >
> > > > What if I wanted to have a comprehensive framework library with > > > > nearly everything you could want built in and supported by
> > > > the runtime and compiler?
> > > >
> > > > What if I wanted to make my code cross-platform without any > > > > fancy magic or special #defines?
> > > >
> > > > What if I wanted a pure OO language without any legacy
> > > > baggage?
> > > >
> > > > -c
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > Great. How should I call functions in a MFC extension
library.
> > > Such
> > > > a
> > > > > library might have functions taking as parameters and/or
returning
> > > > CStrings
> > > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > > would be
> > > > > the equivalent of pure virtual functions and multiple
derivation? I
> > > > am
> > > > > sorry, but the jury is still out.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > > > > > is a system, C# is merely a language on top of it.
> > > > > >
> > > > > > As far as C# being castrated, to me, it seems like has all the
> > > > > > good stuff and almost none of the bad of C++. To each his own,
> > > > > > I guess.
> > > > > >
> > > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > > to Templates in C++.
> > > > > >
> > > > > > As far as finding things C++ does better than .NET, you'll > > > > > > have a hard time. In all but the most contrived
ultra-performance
> > > > > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> > > > > >
> > > > > > Check this out:
> > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > >
> > > > > > In many cases, because IL is JIT'd, it runs faster than > > > > > > equivalent unmanaged code because the JIT can better
determine
> > > > > > at run-time which optimizations will have the most impact. > > > > > >
> > > > > > -c
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in
message
> > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > Would JIT apply to a local executable? I do not
anticipate
> > > doing
> > > > any
> > > > > > web
> > > > > > > stuff for a while. I am looking at doing some
things that I
> > > think
> > > > > > that C++
> > > > > > > is better equipped for than C# (which seems to be
castrated).
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> > > > message
> > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > The C# compiler does not inline functions.
However,
the .NET
> > > > > > runtime/JIT
> > > > > > > is
> > > > > > > > allowed to inline functions, and often does.
> > > > > > > >
> > > > > > > > --
> > > > > > > > --Grant
> > > > > > > > This posting is provided "AS IS" with no
warranties,
and > > > confers
> > > > no
> > > > > > > rights.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Will Pittenger" <wi************@verizon.net>
wrote
in message
> > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Does C# inline functions? I do not see a inline
keyword.
> > > Is
> > > > > > there an
> > > > > > > > > implicit inline? Can the compiler select functions for
> > > > > > auto-inlining?
> > > > > > > I
> > > > > > > > am
> > > > > > > > > more used to C++ where all these things are possible. > > > > > > > > > ----------
> > > > > > > > > Will Pittenger
> > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #16
Here is another hypothetical scenario for you, also based on real world
experience:

You are working on a computer program that will fly airplanes. One program,
running on just one computer (with perhaps backups that do nothing unless
there is a major problem) displays a map of where you are and routes
commands from the controls to the flight system. (The stick and rudder
pedal are just computer controls, like on many modern aircraft.) You have
to update the screen quickly so the pilot knows where he or she is.
However, you do not want to spend any serious amount of time (as measured in
a percentage of CPU cycles used) painting the screen. If you spend too much
time painting, the airplane could be headed towards a big mountain, but
never responds to the pilot's attempt to turn it away from that mountain
because it is too busy updating the screen. If you are a passenger on that
plane, what do you want updating the screen: Windows GDI, MFC, C# and
Graphics, OpenGL, or DirectX? If a fancy look were important, you might
vote for DirectX or OpenGL. But with lives on the line, you very quickly
consider fancy graphics to be extra baggage. At that point, I vote for the
Windows GDI. Now if .NET implements its stuff at a lower level than I have
the impression that it does, perhaps it would work. Not otherwise.

Now in a real airplane, there would be many computers to drive just the
displays. The controls would be on a second set of systems. Still, we ran
into that problem where the software runs boats. We were not talking about
something that sold for hundreds of million of dollars. Customers spent
only a small fraction of their money on the computers and software. A
luxurious interior is typically more important. You get one computer, and
you are lucky if it is a top of the line laptop. Most of the marine worthy
laptops are slow even new even compared to just other laptops.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
How should I call functions in a MFC extension library


That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.
What would be the equivalent of pure virtual functions


Abstract classes and methods
and multiple derivation


Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
Great. How should I call functions in a MFC extension library. Such
a
library might have functions taking as parameters and/or returning

CStrings
and CWnds. (Or for that matter a generic C++ style class.) What

would be
the equivalent of pure virtual functions and multiple derivation? I

am
sorry, but the jury is still out.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:AK*********************@twister.austin.rr.com ...
> JIT applies to all .NET assemblies, not just C#. Remember, .NET
> is a system, C# is merely a language on top of it.
>
> As far as C# being castrated, to me, it seems like has all the
> good stuff and almost none of the bad of C++. To each his own,
> I guess.
>
> They're adding Generics in C# for .NET 2.0 which are similar
> to Templates in C++.
>
> As far as finding things C++ does better than .NET, you'll
> have a hard time. In all but the most contrived ultra-performance
> scenarios, .NET has many advantages over unmanaged C/C++ code.
>
> Check this out:
> http://tinyurl.com/3890 [MSDN article]
>
> In many cases, because IL is JIT'd, it runs faster than
> equivalent unmanaged code because the JIT can better determine
> at run-time which optimizations will have the most impact.
>
> -c
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:%2****************@tk2msftngp13.phx.gbl...
> > Would JIT apply to a local executable? I do not anticipate

doing
any
> web
> > stuff for a while. I am looking at doing some things that I

think > that C++
> > is better equipped for than C# (which seems to be castrated).
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in

message
> > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > The C# compiler does not inline functions. However, the .NET
> runtime/JIT
> > is
> > > allowed to inline functions, and often does.
> > >
> > > --
> > > --Grant
> > > This posting is provided "AS IS" with no warranties, and confers
no
> > rights.
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > Does C# inline functions? I do not see a inline keyword.

Is > there an
> > > > implicit inline? Can the compiler select functions for
> auto-inlining?
> > I
> > > am
> > > > more used to C++ where all these things are possible.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #17
If your C# code is called on to draw something by older C-style code, that
C-style code is probably going to pass HBRUSHs and HWNDs rather than the
C#/.NET equivalents. (You might be reimplementing a DLL that an older C
program relied on. You are keeping the older program.)
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:aS*********************@twister.austin.rr.com ...
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and

other
control classes? Besides, DrawFrameControl uses the same Windows code

that
Windows itself uses to draw caption bar buttons, radio buttons,

scrollbars,
and more. (The control's WM_PAINT handler calls DrawFrameControl.)

That
means that if your control uses DrawFrameControl for objects that look

like
buttons, they will look like buttons regardless of which Windows

version you
are on. You might have written a button class that displays graphics

for
Windows 3.1 and it would look like a Windows 3.1 button until you ran

the
program under Windows 9x. Then Windows would make your button look

like a
Windows 9x button. If you later provided a manifest, you could skin

your
button -- with no code. All you would ever paint is the graphic.

That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you

draw the
drop border you need for custom edit box-like areas. DrawEdge (MFC

and GDI)
is what you would use if you wanted a group box style etched (or

raised)
line, or a diagonal 3d line. I think that Jay Harlow provided what I

was
looking for. DirectX and OpenGL sound like the sledge hammer

providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
> Almost forgot. CDC provides THREE members which draw 3D edges and/or > rectangles. How many does Graphics in C# provide? I see none.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:eb**************@TK2MSFTNGP09.phx.gbl...
> > The scenario that I had in mind was you have to use a DLL that is already
> on
> > a user's machine. You are required to coexist with a larger and
older MFC
> > based program. Most of what you need is in one of its DLLs.
Perhaps that
> > DLL has tools for accessing a file format that you have no control or
> > knowledge of. I have had to put up with that many times. Good
luck.
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:hh*********************@twister.austin.rr.com ...
> > > Oh yeah, one other thing... why on EARTH would you want to use
> > > MFC when you have .NET now? I can't even fathom the concept...!! > > >
> > > :)
> > >
> > > -c
> > >
> > >
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:Z8*********************@twister.austin.rr.com ...
> > > > >How should I call functions in a MFC extension library
> > > >
> > > > That's difficult, but if it's a COM interface, it can be done. > > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > > a wrapper.
> > > >
> > > > That's not a fair criticism of C#, really, because you can't
> > > > use .NET assemblies in C++ either.
> > > >
> > > > > What would be the equivalent of pure virtual functions
> > > >
> > > > Abstract classes and methods
> > > >
> > > > > and multiple derivation
> > > >
> > > > Multiple inheritence, you mean? There was a concious decision > > > > not to support MI in .NET because ... well, that's a very long > > > > debate, but it's not because they couldn't do it, it's because > > > > they didn't want to do it and felt it was wrong to do it.
> > > >
> > > > Let's turn the tables...
> > > >
> > > > What if I wanted didn't want to do any of my memory management > > > > in C++?
> > > >
> > > > What if I wanted to have a comprehensive framework library with > > > > nearly everything you could want built in and supported by
> > > > the runtime and compiler?
> > > >
> > > > What if I wanted to make my code cross-platform without any
> > > > fancy magic or special #defines?
> > > >
> > > > What if I wanted a pure OO language without any legacy
> > > > baggage?
> > > >
> > > > -c
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > Great. How should I call functions in a MFC extension
library.
> > > Such
> > > > a
> > > > > library might have functions taking as parameters and/or
returning
> > > > CStrings
> > > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > > would be
> > > > > the equivalent of pure virtual functions and multiple
derivation? I
> > > > am
> > > > > sorry, but the jury is still out.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > > > > > is a system, C# is merely a language on top of it.
> > > > > >
> > > > > > As far as C# being castrated, to me, it seems like has all the
> > > > > > good stuff and almost none of the bad of C++. To each his own,
> > > > > > I guess.
> > > > > >
> > > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > > to Templates in C++.
> > > > > >
> > > > > > As far as finding things C++ does better than .NET, you'll > > > > > > have a hard time. In all but the most contrived
ultra-performance
> > > > > > scenarios, .NET has many advantages over unmanaged C/C++
code.
> > > > > >
> > > > > > Check this out:
> > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > >
> > > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > > equivalent unmanaged code because the JIT can better
determine
> > > > > > at run-time which optimizations will have the most impact. > > > > > >
> > > > > > -c
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in
message
> > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > Would JIT apply to a local executable? I do not
anticipate
> > > doing
> > > > any
> > > > > > web
> > > > > > > stuff for a while. I am looking at doing some things that I
> > > think
> > > > > > that C++
> > > > > > > is better equipped for than C# (which seems to be
castrated).
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> > > > message
> > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > The C# compiler does not inline functions. However, the .NET
> > > > > > runtime/JIT
> > > > > > > is
> > > > > > > > allowed to inline functions, and often does.
> > > > > > > >
> > > > > > > > --
> > > > > > > > --Grant
> > > > > > > > This posting is provided "AS IS" with no warranties, and > > > confers
> > > > no
> > > > > > > rights.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Does C# inline functions? I do not see a inline
keyword.
> > > Is
> > > > > > there an
> > > > > > > > > implicit inline? Can the compiler select functions for
> > > > > > auto-inlining?
> > > > > > > I
> > > > > > > > am
> > > > > > > > > more used to C++ where all these things are possible. > > > > > > > > > ----------
> > > > > > > > > Will Pittenger
> > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #18
..NET has a rich GDI implementation, so use GDI. However, I'd say
that GDI is slow and if you really wanted fast 2D rendering,
then using DirectDraw would be preferable. DirectDraw is very
simple and horribly fast. Even on crappy video cards, DD would
be faster than GDI.

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here is another hypothetical scenario for you, also based on real world experience:

You are working on a computer program that will fly airplanes. One program, running on just one computer (with perhaps backups that do nothing unless there is a major problem) displays a map of where you are and routes
commands from the controls to the flight system. (The stick and rudder pedal are just computer controls, like on many modern aircraft.) You have to update the screen quickly so the pilot knows where he or she is.
However, you do not want to spend any serious amount of time (as measured in a percentage of CPU cycles used) painting the screen. If you spend too much time painting, the airplane could be headed towards a big mountain, but never responds to the pilot's attempt to turn it away from that mountain because it is too busy updating the screen. If you are a passenger on that plane, what do you want updating the screen: Windows GDI, MFC, C# and
Graphics, OpenGL, or DirectX? If a fancy look were important, you might vote for DirectX or OpenGL. But with lives on the line, you very quickly consider fancy graphics to be extra baggage. At that point, I vote for the Windows GDI. Now if .NET implements its stuff at a lower level than I have the impression that it does, perhaps it would work. Not otherwise.

Now in a real airplane, there would be many computers to drive just the displays. The controls would be on a second set of systems. Still, we ran into that problem where the software runs boats. We were not talking about something that sold for hundreds of million of dollars. Customers spent only a small fraction of their money on the computers and software. A
luxurious interior is typically more important. You get one computer, and you are lucky if it is a top of the line laptop. Most of the marine worthy laptops are slow even new even compared to just other laptops.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
>How should I call functions in a MFC extension library

That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.

> What would be the equivalent of pure virtual functions

Abstract classes and methods

> and multiple derivation

Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
> Great. How should I call functions in a MFC extension library.

Such
a
> library might have functions taking as parameters and/or returning CStrings
> and CWnds. (Or for that matter a generic C++ style class.) What would be
> the equivalent of pure virtual functions and multiple derivation? I am
> sorry, but the jury is still out.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:AK*********************@twister.austin.rr.com ...
> > JIT applies to all .NET assemblies, not just C#. Remember, ..NET > > is a system, C# is merely a language on top of it.
> >
> > As far as C# being castrated, to me, it seems like has all the
> > good stuff and almost none of the bad of C++. To each his own,
> > I guess.
> >
> > They're adding Generics in C# for .NET 2.0 which are similar
> > to Templates in C++.
> >
> > As far as finding things C++ does better than .NET, you'll
> > have a hard time. In all but the most contrived ultra-performance > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> >
> > Check this out:
> > http://tinyurl.com/3890 [MSDN article]
> >
> > In many cases, because IL is JIT'd, it runs faster than
> > equivalent unmanaged code because the JIT can better determine
> > at run-time which optimizations will have the most impact.
> >
> > -c
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > Would JIT apply to a local executable? I do not anticipate

doing
any
> > web
> > > stuff for a while. I am looking at doing some things that I

think
> > that C++
> > > is better equipped for than C# (which seems to be castrated). > > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
message
> > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > The C# compiler does not inline functions. However, the ..NET > > runtime/JIT
> > > is
> > > > allowed to inline functions, and often does.
> > > >
> > > > --
> > > > --Grant
> > > > This posting is provided "AS IS" with no warranties, and

confers
no
> > > rights.
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > Does C# inline functions? I do not see a inline
keyword. Is
> > there an
> > > > > implicit inline? Can the compiler select functions for
> > auto-inlining?
> > > I
> > > > am
> > > > > more used to C++ where all these things are possible.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #19
I was told earlier that the Win32 functions for exiting Windows and checking
or changing process rights were not available through .NET. Are you going
to tell me something different?
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:aS*********************@twister.austin.rr.com ...
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and

other
control classes? Besides, DrawFrameControl uses the same Windows code

that
Windows itself uses to draw caption bar buttons, radio buttons,

scrollbars,
and more. (The control's WM_PAINT handler calls DrawFrameControl.)

That
means that if your control uses DrawFrameControl for objects that look

like
buttons, they will look like buttons regardless of which Windows

version you
are on. You might have written a button class that displays graphics

for
Windows 3.1 and it would look like a Windows 3.1 button until you ran

the
program under Windows 9x. Then Windows would make your button look

like a
Windows 9x button. If you later provided a manifest, you could skin

your
button -- with no code. All you would ever paint is the graphic.

That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you

draw the
drop border you need for custom edit box-like areas. DrawEdge (MFC

and GDI)
is what you would use if you wanted a group box style etched (or

raised)
line, or a diagonal 3d line. I think that Jay Harlow provided what I

was
looking for. DirectX and OpenGL sound like the sledge hammer

providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
Managed DirectX 9. Anything you could possibly want.

What is CDC? Why would you want to use that over DX anyhow?

Also, there's an OpenGL implementation for .NET (written in
C#, remember, C# is just a language, it doens't really provide
anything, .NET provides all the functionality).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
> Almost forgot. CDC provides THREE members which draw 3D edges and/or > rectangles. How many does Graphics in C# provide? I see none.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:eb**************@TK2MSFTNGP09.phx.gbl...
> > The scenario that I had in mind was you have to use a DLL that is already
> on
> > a user's machine. You are required to coexist with a larger and
older MFC
> > based program. Most of what you need is in one of its DLLs.
Perhaps that
> > DLL has tools for accessing a file format that you have no control or
> > knowledge of. I have had to put up with that many times. Good
luck.
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:hh*********************@twister.austin.rr.com ...
> > > Oh yeah, one other thing... why on EARTH would you want to use
> > > MFC when you have .NET now? I can't even fathom the concept...!! > > >
> > > :)
> > >
> > > -c
> > >
> > >
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:Z8*********************@twister.austin.rr.com ...
> > > > >How should I call functions in a MFC extension library
> > > >
> > > > That's difficult, but if it's a COM interface, it can be done. > > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > > a wrapper.
> > > >
> > > > That's not a fair criticism of C#, really, because you can't
> > > > use .NET assemblies in C++ either.
> > > >
> > > > > What would be the equivalent of pure virtual functions
> > > >
> > > > Abstract classes and methods
> > > >
> > > > > and multiple derivation
> > > >
> > > > Multiple inheritence, you mean? There was a concious decision > > > > not to support MI in .NET because ... well, that's a very long > > > > debate, but it's not because they couldn't do it, it's because > > > > they didn't want to do it and felt it was wrong to do it.
> > > >
> > > > Let's turn the tables...
> > > >
> > > > What if I wanted didn't want to do any of my memory management > > > > in C++?
> > > >
> > > > What if I wanted to have a comprehensive framework library with > > > > nearly everything you could want built in and supported by
> > > > the runtime and compiler?
> > > >
> > > > What if I wanted to make my code cross-platform without any
> > > > fancy magic or special #defines?
> > > >
> > > > What if I wanted a pure OO language without any legacy
> > > > baggage?
> > > >
> > > > -c
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > Great. How should I call functions in a MFC extension
library.
> > > Such
> > > > a
> > > > > library might have functions taking as parameters and/or
returning
> > > > CStrings
> > > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > > would be
> > > > > the equivalent of pure virtual functions and multiple
derivation? I
> > > > am
> > > > > sorry, but the jury is still out.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > > > > > is a system, C# is merely a language on top of it.
> > > > > >
> > > > > > As far as C# being castrated, to me, it seems like has all the
> > > > > > good stuff and almost none of the bad of C++. To each his own,
> > > > > > I guess.
> > > > > >
> > > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > > to Templates in C++.
> > > > > >
> > > > > > As far as finding things C++ does better than .NET, you'll > > > > > > have a hard time. In all but the most contrived
ultra-performance
> > > > > > scenarios, .NET has many advantages over unmanaged C/C++
code.
> > > > > >
> > > > > > Check this out:
> > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > >
> > > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > > equivalent unmanaged code because the JIT can better
determine
> > > > > > at run-time which optimizations will have the most impact. > > > > > >
> > > > > > -c
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in
message
> > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > Would JIT apply to a local executable? I do not
anticipate
> > > doing
> > > > any
> > > > > > web
> > > > > > > stuff for a while. I am looking at doing some things that I
> > > think
> > > > > > that C++
> > > > > > > is better equipped for than C# (which seems to be
castrated).
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> > > > message
> > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > The C# compiler does not inline functions. However, the .NET
> > > > > > runtime/JIT
> > > > > > > is
> > > > > > > > allowed to inline functions, and often does.
> > > > > > > >
> > > > > > > > --
> > > > > > > > --Grant
> > > > > > > > This posting is provided "AS IS" with no warranties, and > > > confers
> > > > no
> > > > > > > rights.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Does C# inline functions? I do not see a inline
keyword.
> > > Is
> > > > > > there an
> > > > > > > > > implicit inline? Can the compiler select functions for
> > > > > > auto-inlining?
> > > > > > > I
> > > > > > > > am
> > > > > > > > > more used to C++ where all these things are possible. > > > > > > > > > ----------
> > > > > > > > > Will Pittenger
> > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #20
"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
That
means that if your control uses DrawFrameControl for objects that look like buttons, they will look like buttons regardless of which Windows version you are on.
Not in xp
All you would ever paint is the graphic. That is
what you use DrawFrameControl for.
That is not correct, you have to use uxtheme-drawing for xp
Draw3dRect (MFC only) lets you draw the
drop border you need for custom edit box-like areas.
DrawEdge (MFC and GDI)
is what you would use if you wanted a group box style etched (or raised)
line, or a diagonal 3d line.
dotnet uses GDI+, that's the reason those methods exists in the WindowsForms
namespace and not in Drawing.
DirectX and OpenGL sound like the sledge hammer providing a
slight tap.


i agree that are not yet ready for normal apps, but seems that is changing
Nov 15 '05 #21
The .NET GDI implementation is a medium-thickness wrapper around
the direct Win32 GDI calls. You can take in HBITMAPS, HWNDs,
HDCs, etc. You can create brushes, but I can't see where you can
create a .NET brush from an HBRUSH handle. I'm not a GDI expert,
so please forgive me, I'm probbly

Again, C# is just a language, we're really talking about .NET here,
..NET has all the functionality, C# is just a language.
If you so liked, you could write mostly equivalent code in VB.NET,
COBOL.NET, Python.NET, J#, etc.

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
If your C# code is called on to draw something by older C-style code, that C-style code is probably going to pass HBRUSHs and HWNDs rather than the C#/.NET equivalents. (You might be reimplementing a DLL that an older C program relied on. You are keeping the older program.)
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:aS*********************@twister.austin.rr.com ...
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and
other
control classes? Besides, DrawFrameControl uses the same Windows
code that
Windows itself uses to draw caption bar buttons, radio buttons,

scrollbars,
and more. (The control's WM_PAINT handler calls
DrawFrameControl.) That
means that if your control uses DrawFrameControl for objects that
look like
buttons, they will look like buttons regardless of which Windows

version you
are on. You might have written a button class that displays
graphics for
Windows 3.1 and it would look like a Windows 3.1 button until you
ran the
program under Windows 9x. Then Windows would make your button
look like a
Windows 9x button. If you later provided a manifest, you could
skin your
button -- with no code. All you would ever paint is the graphic.

That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you

draw the
drop border you need for custom edit box-like areas. DrawEdge
(MFC and GDI)
is what you would use if you wanted a group box style etched (or

raised)
line, or a diagonal 3d line. I think that Jay Harlow provided
what I was
looking for. DirectX and OpenGL sound like the sledge hammer

providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
> Managed DirectX 9. Anything you could possibly want.
>
> What is CDC? Why would you want to use that over DX anyhow?
>
> Also, there's an OpenGL implementation for .NET (written in
> C#, remember, C# is just a language, it doens't really provide
> anything, .NET provides all the functionality).
>
> -c
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:%2***************@TK2MSFTNGP09.phx.gbl...
> > Almost forgot. CDC provides THREE members which draw 3D
edges and/or
> > rectangles. How many does Graphics in C# provide? I see
none. > > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:eb**************@TK2MSFTNGP09.phx.gbl...
> > > The scenario that I had in mind was you have to use a DLL that is
> already
> > on
> > > a user's machine. You are required to coexist with a larger
and > older MFC
> > > based program. Most of what you need is in one of its DLLs.
> Perhaps that
> > > DLL has tools for accessing a file format that you have no

control
> or
> > > knowledge of. I have had to put up with that many times. Good > luck.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > news:hh*********************@twister.austin.rr.com ...
> > > > Oh yeah, one other thing... why on EARTH would you want to use > > > > MFC when you have .NET now? I can't even fathom the

concept...!!
> > > >
> > > > :)
> > > >
> > > > -c
> > > >
> > > >
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > news:Z8*********************@twister.austin.rr.com ...
> > > > > >How should I call functions in a MFC extension library
> > > > >
> > > > > That's difficult, but if it's a COM interface, it can be

done.
> > > > > Otherwise, you'll have to use Managed Extensions for C++ to make
> > > > > a wrapper.
> > > > >
> > > > > That's not a fair criticism of C#, really, because you
can't > > > > > use .NET assemblies in C++ either.
> > > > >
> > > > > > What would be the equivalent of pure virtual functions
> > > > >
> > > > > Abstract classes and methods
> > > > >
> > > > > > and multiple derivation
> > > > >
> > > > > Multiple inheritence, you mean? There was a concious

decision
> > > > > not to support MI in .NET because ... well, that's a very long
> > > > > debate, but it's not because they couldn't do it, it's

because
> > > > > they didn't want to do it and felt it was wrong to do
it. > > > > >
> > > > > Let's turn the tables...
> > > > >
> > > > > What if I wanted didn't want to do any of my memory

management
> > > > > in C++?
> > > > >
> > > > > What if I wanted to have a comprehensive framework library with
> > > > > nearly everything you could want built in and supported
by > > > > > the runtime and compiler?
> > > > >
> > > > > What if I wanted to make my code cross-platform without any > > > > > fancy magic or special #defines?
> > > > >
> > > > > What if I wanted a pure OO language without any legacy
> > > > > baggage?
> > > > >
> > > > > -c
> > > > >
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message
> > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > > Great. How should I call functions in a MFC extension
> library.
> > > > Such
> > > > > a
> > > > > > library might have functions taking as parameters and/or > returning
> > > > > CStrings
> > > > > > and CWnds. (Or for that matter a generic C++ style

class.)
> What
> > > > > would be
> > > > > > the equivalent of pure virtual functions and multiple
> derivation? I
> > > > > am
> > > > > > sorry, but the jury is still out.
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in

message
> > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > > JIT applies to all .NET assemblies, not just C#.

Remember,
> .NET
> > > > > > > is a system, C# is merely a language on top of it.
> > > > > > >
> > > > > > > As far as C# being castrated, to me, it seems like has all
> the
> > > > > > > good stuff and almost none of the bad of C++. To
each his
> own,
> > > > > > > I guess.
> > > > > > >
> > > > > > > They're adding Generics in C# for .NET 2.0 which are

similar
> > > > > > > to Templates in C++.
> > > > > > >
> > > > > > > As far as finding things C++ does better than .NET,

you'll
> > > > > > > have a hard time. In all but the most contrived
> ultra-performance
> > > > > > > scenarios, .NET has many advantages over unmanaged
C/C++ > code.
> > > > > > >
> > > > > > > Check this out:
> > > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > > >
> > > > > > > In many cases, because IL is JIT'd, it runs faster than > > > > > > > equivalent unmanaged code because the JIT can better
> determine
> > > > > > > at run-time which optimizations will have the most

impact.
> > > > > > >
> > > > > > > -c
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in > message
> > > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > > Would JIT apply to a local executable? I do not
> anticipate
> > > > doing
> > > > > any
> > > > > > > web
> > > > > > > > stuff for a while. I am looking at doing some things that
> I
> > > > think
> > > > > > > that C++
> > > > > > > > is better equipped for than C# (which seems to be
> castrated).
> > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > "Grant Richins [MS]"
<gr*****@online.microsoft.com> wrote
> in
> > > > > message
> > > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > The C# compiler does not inline functions.
However, the
> .NET
> > > > > > > runtime/JIT
> > > > > > > > is
> > > > > > > > > allowed to inline functions, and often does.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > --Grant
> > > > > > > > > This posting is provided "AS IS" with no
warranties, and
> > > > confers
> > > > > no
> > > > > > > > rights.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Will Pittenger" <wi************@verizon.net>
wrote in
> message
> > > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > > Does C# inline functions? I do not see a

inline > keyword.
> > > > Is
> > > > > > > there an
> > > > > > > > > > implicit inline? Can the compiler select

functions
> for
> > > > > > > auto-inlining?
> > > > > > > > I
> > > > > > > > > am
> > > > > > > > > > more used to C++ where all these things are

possible.
> > > > > > > > > > ----------
> > > > > > > > > > Will Pittenger
> > > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #22
Note that I said all but a handful. Unfortunately I don't
know the entire Win32 API and how they all relate to .NET,
but I wouldn't be suprised if a handful didn't work in .NET.

As far as process rights, like activating a token privilege,
I know that most of those work. I'm not sure about your specific
case.

As far as exit windows for reboot, I'm pretty sure that works,
but again, there are various parameters to ExitWindows and
ExitWindowsEx, and some of those might not be possible in .NET,
but I could be wrong.

Most of the Win32 API works, the problem is various Functions
take or return complicated structures that have variable
sized memory patterns which can be complicated, or, in some
cases, impossible to do with .NET's managed memory space.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:uh*************@TK2MSFTNGP10.phx.gbl...
I was told earlier that the Win32 functions for exiting Windows and checking or changing process rights were not available through .NET. Are you going to tell me something different?
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:aS*********************@twister.austin.rr.com ...
You can call all but a handful of Win32 APIs from .NET.

So if you can do it through GDI, then you can do it in Win32.
A lot of the GDI is implemented in the .NET Framework already.

I'm not familiar with your specific case, but it's probably
doable in .NET, though I'm not sure why'd you'd be doing such
things. It seems C++ developers like to break from the norm
and rewrite the entire UI and you end up with horrible UIs
that are inconsistent with the rest of the OS. The .NET
framework provides dozens of controls that are all XP-themeable.
You'd have a hard time finding a reason where those aren't
good enough (well, fancier DataGrids are pretty handy, but
as far as basic controls like textboxes, etc).

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
Why get DirectX or OpenGL in involved to just a bunch of button and
other
control classes? Besides, DrawFrameControl uses the same Windows
code that
Windows itself uses to draw caption bar buttons, radio buttons,

scrollbars,
and more. (The control's WM_PAINT handler calls
DrawFrameControl.) That
means that if your control uses DrawFrameControl for objects that
look like
buttons, they will look like buttons regardless of which Windows

version you
are on. You might have written a button class that displays
graphics for
Windows 3.1 and it would look like a Windows 3.1 button until you
ran the
program under Windows 9x. Then Windows would make your button
look like a
Windows 9x button. If you later provided a manifest, you could
skin your
button -- with no code. All you would ever paint is the graphic.

That is
what you use DrawFrameControl for. Draw3dRect (MFC only) lets you

draw the
drop border you need for custom edit box-like areas. DrawEdge
(MFC and GDI)
is what you would use if you wanted a group box style etched (or

raised)
line, or a diagonal 3d line. I think that Jay Harlow provided
what I was
looking for. DirectX and OpenGL sound like the sledge hammer

providing a
slight tap.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:IF*********************@twister.austin.rr.com ...
> Managed DirectX 9. Anything you could possibly want.
>
> What is CDC? Why would you want to use that over DX anyhow?
>
> Also, there's an OpenGL implementation for .NET (written in
> C#, remember, C# is just a language, it doens't really provide
> anything, .NET provides all the functionality).
>
> -c
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:%2***************@TK2MSFTNGP09.phx.gbl...
> > Almost forgot. CDC provides THREE members which draw 3D
edges and/or
> > rectangles. How many does Graphics in C# provide? I see
none. > > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:eb**************@TK2MSFTNGP09.phx.gbl...
> > > The scenario that I had in mind was you have to use a DLL that is
> already
> > on
> > > a user's machine. You are required to coexist with a larger
and > older MFC
> > > based program. Most of what you need is in one of its DLLs.
> Perhaps that
> > > DLL has tools for accessing a file format that you have no

control
> or
> > > knowledge of. I have had to put up with that many times. Good > luck.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > news:hh*********************@twister.austin.rr.com ...
> > > > Oh yeah, one other thing... why on EARTH would you want to use > > > > MFC when you have .NET now? I can't even fathom the

concept...!!
> > > >
> > > > :)
> > > >
> > > > -c
> > > >
> > > >
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > news:Z8*********************@twister.austin.rr.com ...
> > > > > >How should I call functions in a MFC extension library
> > > > >
> > > > > That's difficult, but if it's a COM interface, it can be

done.
> > > > > Otherwise, you'll have to use Managed Extensions for C++ to make
> > > > > a wrapper.
> > > > >
> > > > > That's not a fair criticism of C#, really, because you
can't > > > > > use .NET assemblies in C++ either.
> > > > >
> > > > > > What would be the equivalent of pure virtual functions
> > > > >
> > > > > Abstract classes and methods
> > > > >
> > > > > > and multiple derivation
> > > > >
> > > > > Multiple inheritence, you mean? There was a concious

decision
> > > > > not to support MI in .NET because ... well, that's a very long
> > > > > debate, but it's not because they couldn't do it, it's

because
> > > > > they didn't want to do it and felt it was wrong to do
it. > > > > >
> > > > > Let's turn the tables...
> > > > >
> > > > > What if I wanted didn't want to do any of my memory

management
> > > > > in C++?
> > > > >
> > > > > What if I wanted to have a comprehensive framework library with
> > > > > nearly everything you could want built in and supported
by > > > > > the runtime and compiler?
> > > > >
> > > > > What if I wanted to make my code cross-platform without any > > > > > fancy magic or special #defines?
> > > > >
> > > > > What if I wanted a pure OO language without any legacy
> > > > > baggage?
> > > > >
> > > > > -c
> > > > >
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message
> > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > > Great. How should I call functions in a MFC extension
> library.
> > > > Such
> > > > > a
> > > > > > library might have functions taking as parameters and/or > returning
> > > > > CStrings
> > > > > > and CWnds. (Or for that matter a generic C++ style

class.)
> What
> > > > > would be
> > > > > > the equivalent of pure virtual functions and multiple
> derivation? I
> > > > > am
> > > > > > sorry, but the jury is still out.
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in

message
> > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > > JIT applies to all .NET assemblies, not just C#.

Remember,
> .NET
> > > > > > > is a system, C# is merely a language on top of it.
> > > > > > >
> > > > > > > As far as C# being castrated, to me, it seems like has all
> the
> > > > > > > good stuff and almost none of the bad of C++. To
each his
> own,
> > > > > > > I guess.
> > > > > > >
> > > > > > > They're adding Generics in C# for .NET 2.0 which are

similar
> > > > > > > to Templates in C++.
> > > > > > >
> > > > > > > As far as finding things C++ does better than .NET,

you'll
> > > > > > > have a hard time. In all but the most contrived
> ultra-performance
> > > > > > > scenarios, .NET has many advantages over unmanaged
C/C++ > code.
> > > > > > >
> > > > > > > Check this out:
> > > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > > >
> > > > > > > In many cases, because IL is JIT'd, it runs faster than > > > > > > > equivalent unmanaged code because the JIT can better
> determine
> > > > > > > at run-time which optimizations will have the most

impact.
> > > > > > >
> > > > > > > -c
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in > message
> > > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > > Would JIT apply to a local executable? I do not
> anticipate
> > > > doing
> > > > > any
> > > > > > > web
> > > > > > > > stuff for a while. I am looking at doing some things that
> I
> > > > think
> > > > > > > that C++
> > > > > > > > is better equipped for than C# (which seems to be
> castrated).
> > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > "Grant Richins [MS]"
<gr*****@online.microsoft.com> wrote
> in
> > > > > message
> > > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > The C# compiler does not inline functions.
However, the
> .NET
> > > > > > > runtime/JIT
> > > > > > > > is
> > > > > > > > > allowed to inline functions, and often does.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > --Grant
> > > > > > > > > This posting is provided "AS IS" with no
warranties, and
> > > > confers
> > > > > no
> > > > > > > > rights.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Will Pittenger" <wi************@verizon.net>
wrote in
> message
> > > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > > Does C# inline functions? I do not see a

inline > keyword.
> > > > Is
> > > > > > > there an
> > > > > > > > > > implicit inline? Can the compiler select

functions
> for
> > > > > > > auto-inlining?
> > > > > > > > I
> > > > > > > > > am
> > > > > > > > > > more used to C++ where all these things are

possible.
> > > > > > > > > > ----------
> > > > > > > > > > Will Pittenger
> > > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #23
So if I am calling System.Windows.Forms.ControlPaint.DrawButton, what would
be the ButtonState value that would correspond to DFCS_HOT when calling
DrawFrameControl?

--
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
Will,
Most of the 3d edges and/or rectangles functions are in the
System.Windows.Forms.ControlPaint class.

I would recommend considering creating a Managed wrapper for your MFC legacy DLL. Something along the lines of:
http://msdn.microsoft.com/library/de...extensions.asp
Hope this helps
Jay

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or
rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
The scenario that I had in mind was you have to use a DLL that is already
on
a user's machine. You are required to coexist with a larger and older
MFC based program. Most of what you need is in one of its DLLs. Perhaps that DLL has tools for accessing a file format that you have no control or
knowledge of. I have had to put up with that many times. Good luck.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
> Oh yeah, one other thing... why on EARTH would you want to use
> MFC when you have .NET now? I can't even fathom the concept...!!
>
> :)
>
> -c
>
>
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:Z8*********************@twister.austin.rr.com ...
> > >How should I call functions in a MFC extension library
> >
> > That's difficult, but if it's a COM interface, it can be done.
> > Otherwise, you'll have to use Managed Extensions for C++ to make
> > a wrapper.
> >
> > That's not a fair criticism of C#, really, because you can't
> > use .NET assemblies in C++ either.
> >
> > > What would be the equivalent of pure virtual functions
> >
> > Abstract classes and methods
> >
> > > and multiple derivation
> >
> > Multiple inheritence, you mean? There was a concious decision
> > not to support MI in .NET because ... well, that's a very long
> > debate, but it's not because they couldn't do it, it's because
> > they didn't want to do it and felt it was wrong to do it.
> >
> > Let's turn the tables...
> >
> > What if I wanted didn't want to do any of my memory management
> > in C++?
> >
> > What if I wanted to have a comprehensive framework library with
> > nearly everything you could want built in and supported by
> > the runtime and compiler?
> >
> > What if I wanted to make my code cross-platform without any
> > fancy magic or special #defines?
> >
> > What if I wanted a pure OO language without any legacy
> > baggage?
> >
> > -c
> >
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > Great. How should I call functions in a MFC extension library.
> Such
> > a
> > > library might have functions taking as parameters and/or returning > > CStrings
> > > and CWnds. (Or for that matter a generic C++ style class.) What > > would be
> > > the equivalent of pure virtual functions and multiple derivation? I
> > am
> > > sorry, but the jury is still out.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:AK*********************@twister.austin.rr.com ...
> > > > JIT applies to all .NET assemblies, not just C#. Remember,
..NET > > > > is a system, C# is merely a language on top of it.
> > > >
> > > > As far as C# being castrated, to me, it seems like has all the
> > > > good stuff and almost none of the bad of C++. To each his own,
> > > > I guess.
> > > >
> > > > They're adding Generics in C# for .NET 2.0 which are similar
> > > > to Templates in C++.
> > > >
> > > > As far as finding things C++ does better than .NET, you'll
> > > > have a hard time. In all but the most contrived

ultra-performance > > > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> > > >
> > > > Check this out:
> > > > http://tinyurl.com/3890 [MSDN article]
> > > >
> > > > In many cases, because IL is JIT'd, it runs faster than
> > > > equivalent unmanaged code because the JIT can better determine
> > > > at run-time which optimizations will have the most impact.
> > > >
> > > > -c
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > Would JIT apply to a local executable? I do not anticipate
> doing
> > any
> > > > web
> > > > > stuff for a while. I am looking at doing some things that I
> think
> > > > that C++
> > > > > is better equipped for than C# (which seems to be castrated). > > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> > message
> > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > The C# compiler does not inline functions. However, the .NET > > > > runtime/JIT
> > > > > is
> > > > > > allowed to inline functions, and often does.
> > > > > >
> > > > > > --
> > > > > > --Grant
> > > > > > This posting is provided "AS IS" with no warranties, and
> confers
> > no
> > > > > rights.
> > > > > >
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > Does C# inline functions? I do not see a inline keyword. > Is
> > > > there an
> > > > > > > implicit inline? Can the compiler select functions for
> > > > auto-inlining?
> > > > > I
> > > > > > am
> > > > > > > more used to C++ where all these things are possible.
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #24
There is none in the Framework.

You'd have to call DrawFrameControl manually.

The .NET Framework does not encompass the entire Win32 API,
which is why you have to call the methods sometime. If you
wish to use that as an excuse to forgo all the other great
features .NET has for that one function, that's great for
you, I guess.

public struct RECT
{
int left;
int top;
int right;
int bottom;
}

[DllImport("gdi32.dll")]
private static extern DrawFrameControl(
IntPtr hdc,
ref RECT lprc,
uint uType,
uint uState
)

public const DFC_BUTTON = 0x4;

public const DFCS_HOT = 0x1000;

....

RECT r = new RECT()
r.left = 5;
r.top = 5;
r.right = 20;
r.bottom = 10;

DrawFrameControl( button1.Handle, ref r, DFC_BUTTON, DFCS_HOT );

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
So if I am calling System.Windows.Forms.ControlPaint.DrawButton, what would be the ButtonState value that would correspond to DFCS_HOT when calling DrawFrameControl?

--
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:OJ**************@TK2MSFTNGP09.phx.gbl...
Will,
Most of the 3d edges and/or rectangles functions are in the
System.Windows.Forms.ControlPaint class.

I would recommend considering creating a Managed wrapper for your MFC
legacy
DLL. Something along the lines of:

http://msdn.microsoft.com/library/de...extensions.asp

Hope this helps
Jay

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Almost forgot. CDC provides THREE members which draw 3D edges and/or rectangles. How many does Graphics in C# provide? I see none.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Will Pittenger" <wi************@verizon.net> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
> The scenario that I had in mind was you have to use a DLL that is
already
on
> a user's machine. You are required to coexist with a larger and
older MFC
> based program. Most of what you need is in one of its DLLs.
Perhaps that
> DLL has tools for accessing a file format that you have no
control or > knowledge of. I have had to put up with that many times. Good luck. > ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:hh*********************@twister.austin.rr.com ...
> > Oh yeah, one other thing... why on EARTH would you want to use
> > MFC when you have .NET now? I can't even fathom the concept...!! > >
> > :)
> >
> > -c
> >
> >
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:Z8*********************@twister.austin.rr.com ...
> > > >How should I call functions in a MFC extension library
> > >
> > > That's difficult, but if it's a COM interface, it can be done. > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > a wrapper.
> > >
> > > That's not a fair criticism of C#, really, because you can't
> > > use .NET assemblies in C++ either.
> > >
> > > > What would be the equivalent of pure virtual functions
> > >
> > > Abstract classes and methods
> > >
> > > > and multiple derivation
> > >
> > > Multiple inheritence, you mean? There was a concious decision > > > not to support MI in .NET because ... well, that's a very long > > > debate, but it's not because they couldn't do it, it's because > > > they didn't want to do it and felt it was wrong to do it.
> > >
> > > Let's turn the tables...
> > >
> > > What if I wanted didn't want to do any of my memory management > > > in C++?
> > >
> > > What if I wanted to have a comprehensive framework library with > > > nearly everything you could want built in and supported by
> > > the runtime and compiler?
> > >
> > > What if I wanted to make my code cross-platform without any
> > > fancy magic or special #defines?
> > >
> > > What if I wanted a pure OO language without any legacy
> > > baggage?
> > >
> > > -c
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > Great. How should I call functions in a MFC extension library. > > Such
> > > a
> > > > library might have functions taking as parameters and/or

returning > > > CStrings
> > > > and CWnds. (Or for that matter a generic C++ style class.) What
> > > would be
> > > > the equivalent of pure virtual functions and multiple derivation?
I
> > > am
> > > > sorry, but the jury is still out.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in
message > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET > > > > > is a system, C# is merely a language on top of it.
> > > > >
> > > > > As far as C# being castrated, to me, it seems like has
all the > > > > > good stuff and almost none of the bad of C++. To each his own, > > > > > I guess.
> > > > >
> > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > to Templates in C++.
> > > > >
> > > > > As far as finding things C++ does better than .NET, you'll > > > > > have a hard time. In all but the most contrived

ultra-performance
> > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > > >
> > > > > Check this out:
> > > > > http://tinyurl.com/3890 [MSDN article]
> > > > >
> > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > equivalent unmanaged code because the JIT can better determine > > > > > at run-time which optimizations will have the most impact. > > > > >
> > > > > -c
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > Would JIT apply to a local executable? I do not anticipate > > doing
> > > any
> > > > > web
> > > > > > stuff for a while. I am looking at doing some things that I > > think
> > > > > that C++
> > > > > > is better equipped for than C# (which seems to be

castrated). > > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > > message
> > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > The C# compiler does not inline functions. However, the .NET
> > > > > runtime/JIT
> > > > > > is
> > > > > > > allowed to inline functions, and often does.
> > > > > > >
> > > > > > > --
> > > > > > > --Grant
> > > > > > > This posting is provided "AS IS" with no warranties,
and > > confers
> > > no
> > > > > > rights.
> > > > > > >
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in
message
> > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > Does C# inline functions? I do not see a inline

keyword. > > Is
> > > > > there an
> > > > > > > > implicit inline? Can the compiler select

functions for > > > > > auto-inlining?
> > > > > > I
> > > > > > > am
> > > > > > > > more used to C++ where all these things are possible. > > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #25
Actually, no. I would prefer to stay with the .NET as it is handier.
However, I can not find the appropriate stuff half of the time. In this
case, all Microsoft had to do was add the appropriate value to the
ButtonStyle enum. Problem solved. I say that as it sounds like
ControlPaint uses DrawFrameControl behind the scenes for many of its
methods. DrawButton probably evaluates to just a call to DrawFrameControl
with DFC_BUTTON added for you. (That parameter is not in the UI, but since
DrawButton draws only generic buttons, it can be assumed.) I expect the
ButtonStyle values to be defined to match the DFCS values in the SDK. Just
typecast the enum to an int and you are done. In fact, you could declare
you import of DrawFrameControl to do the type cast for you if the enum is
declared properly.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:oc*********************@twister.austin.rr.com ...
There is none in the Framework.

You'd have to call DrawFrameControl manually.

The .NET Framework does not encompass the entire Win32 API,
which is why you have to call the methods sometime. If you
wish to use that as an excuse to forgo all the other great
features .NET has for that one function, that's great for
you, I guess.

public struct RECT
{
int left;
int top;
int right;
int bottom;
}

[DllImport("gdi32.dll")]
private static extern DrawFrameControl(
IntPtr hdc,
ref RECT lprc,
uint uType,
uint uState
)

public const DFC_BUTTON = 0x4;

public const DFCS_HOT = 0x1000;

...

RECT r = new RECT()
r.left = 5;
r.top = 5;
r.right = 20;
r.bottom = 10;

DrawFrameControl( button1.Handle, ref r, DFC_BUTTON, DFCS_HOT );

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
So if I am calling System.Windows.Forms.ControlPaint.DrawButton, what

would
be the ButtonState value that would correspond to DFCS_HOT when

calling
DrawFrameControl?

--
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in

message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
Will,
Most of the 3d edges and/or rectangles functions are in the
System.Windows.Forms.ControlPaint class.

I would recommend considering creating a Managed wrapper for your MFC
legacy
DLL. Something along the lines of:

http://msdn.microsoft.com/library/de...extensions.asp

Hope this helps
Jay

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
> Almost forgot. CDC provides THREE members which draw 3D edges and/or > rectangles. How many does Graphics in C# provide? I see none.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:eb**************@TK2MSFTNGP09.phx.gbl...
> > The scenario that I had in mind was you have to use a DLL that is already
> on
> > a user's machine. You are required to coexist with a larger and older MFC
> > based program. Most of what you need is in one of its DLLs. Perhaps that
> > DLL has tools for accessing a file format that you have no control or > > knowledge of. I have had to put up with that many times. Good luck. > > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:hh*********************@twister.austin.rr.com ...
> > > Oh yeah, one other thing... why on EARTH would you want to use
> > > MFC when you have .NET now? I can't even fathom the concept...!! > > >
> > > :)
> > >
> > > -c
> > >
> > >
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > > news:Z8*********************@twister.austin.rr.com ...
> > > > >How should I call functions in a MFC extension library
> > > >
> > > > That's difficult, but if it's a COM interface, it can be done. > > > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > > a wrapper.
> > > >
> > > > That's not a fair criticism of C#, really, because you can't
> > > > use .NET assemblies in C++ either.
> > > >
> > > > > What would be the equivalent of pure virtual functions
> > > >
> > > > Abstract classes and methods
> > > >
> > > > > and multiple derivation
> > > >
> > > > Multiple inheritence, you mean? There was a concious decision > > > > not to support MI in .NET because ... well, that's a very long > > > > debate, but it's not because they couldn't do it, it's because > > > > they didn't want to do it and felt it was wrong to do it.
> > > >
> > > > Let's turn the tables...
> > > >
> > > > What if I wanted didn't want to do any of my memory management > > > > in C++?
> > > >
> > > > What if I wanted to have a comprehensive framework library with > > > > nearly everything you could want built in and supported by
> > > > the runtime and compiler?
> > > >
> > > > What if I wanted to make my code cross-platform without any
> > > > fancy magic or special #defines?
> > > >
> > > > What if I wanted a pure OO language without any legacy
> > > > baggage?
> > > >
> > > > -c
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > Great. How should I call functions in a MFC extension library. > > > Such
> > > > a
> > > > > library might have functions taking as parameters and/or

returning
> > > > CStrings
> > > > > and CWnds. (Or for that matter a generic C++ style class.)
What
> > > > would be
> > > > > the equivalent of pure virtual functions and multiple

derivation?
I
> > > > am
> > > > > sorry, but the jury is still out.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in

message > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > JIT applies to all .NET assemblies, not just C#. Remember,
.NET
> > > > > > is a system, C# is merely a language on top of it.
> > > > > >
> > > > > > As far as C# being castrated, to me, it seems like has

all the > > > > > > good stuff and almost none of the bad of C++. To each his own, > > > > > > I guess.
> > > > > >
> > > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > > to Templates in C++.
> > > > > >
> > > > > > As far as finding things C++ does better than .NET, you'll > > > > > > have a hard time. In all but the most contrived
ultra-performance
> > > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > > > >
> > > > > > Check this out:
> > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > >
> > > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > > equivalent unmanaged code because the JIT can better determine > > > > > > at run-time which optimizations will have the most impact. > > > > > >
> > > > > > -c
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > Would JIT apply to a local executable? I do not anticipate > > > doing
> > > > any
> > > > > > web
> > > > > > > stuff for a while. I am looking at doing some things that I > > > think
> > > > > > that C++
> > > > > > > is better equipped for than C# (which seems to be

castrated).
> > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > > > message
> > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > The C# compiler does not inline functions. However, the .NET
> > > > > > runtime/JIT
> > > > > > > is
> > > > > > > > allowed to inline functions, and often does.
> > > > > > > >
> > > > > > > > --
> > > > > > > > --Grant
> > > > > > > > This posting is provided "AS IS" with no warranties, and > > > confers
> > > > no
> > > > > > > rights.
> > > > > > > >
> > > > > > > >
> > > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Does C# inline functions? I do not see a inline

keyword.
> > > Is
> > > > > > there an
> > > > > > > > > implicit inline? Can the compiler select functions for > > > > > > auto-inlining?
> > > > > > > I
> > > > > > > > am
> > > > > > > > > more used to C++ where all these things are possible. > > > > > > > > > ----------
> > > > > > > > > Will Pittenger
> > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #26
I agree, it's curious they left that one out. There are several
cases like that, unfortunately.

The WinForms/GDI stuff was hastely put together, it seems
as there are at least one or two spots there you can allocate
a Graphics object from an HBITMAP and have no way to free it
except make a PInvoke call to gdi32.dll::Delete() or DeleteDC
or something like that.

My guess is that 2.0 will be much, much better at least
in that area.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
Actually, no. I would prefer to stay with the .NET as it is handier.
However, I can not find the appropriate stuff half of the time. In this case, all Microsoft had to do was add the appropriate value to the
ButtonStyle enum. Problem solved. I say that as it sounds like
ControlPaint uses DrawFrameControl behind the scenes for many of its
methods. DrawButton probably evaluates to just a call to DrawFrameControl with DFC_BUTTON added for you. (That parameter is not in the UI, but since DrawButton draws only generic buttons, it can be assumed.) I expect the ButtonStyle values to be defined to match the DFCS values in the SDK. Just typecast the enum to an int and you are done. In fact, you could declare you import of DrawFrameControl to do the type cast for you if the enum is declared properly.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:oc*********************@twister.austin.rr.com ...
There is none in the Framework.

You'd have to call DrawFrameControl manually.

The .NET Framework does not encompass the entire Win32 API,
which is why you have to call the methods sometime. If you
wish to use that as an excuse to forgo all the other great
features .NET has for that one function, that's great for
you, I guess.

public struct RECT
{
int left;
int top;
int right;
int bottom;
}

[DllImport("gdi32.dll")]
private static extern DrawFrameControl(
IntPtr hdc,
ref RECT lprc,
uint uType,
uint uState
)

public const DFC_BUTTON = 0x4;

public const DFCS_HOT = 0x1000;

...

RECT r = new RECT()
r.left = 5;
r.top = 5;
r.right = 20;
r.bottom = 10;

DrawFrameControl( button1.Handle, ref r, DFC_BUTTON, DFCS_HOT );

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
So if I am calling System.Windows.Forms.ControlPaint.DrawButton, what
would
be the ButtonState value that would correspond to DFCS_HOT when

calling
DrawFrameControl?

--
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote
in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
> Will,
> Most of the 3d edges and/or rectangles functions are in the
> System.Windows.Forms.ControlPaint class.
>
> I would recommend considering creating a Managed wrapper for
your MFC
legacy
> DLL. Something along the lines of:
>

http://msdn.microsoft.com/library/de...extensions.asp >
> Hope this helps
> Jay
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:%2***************@TK2MSFTNGP09.phx.gbl...
> > Almost forgot. CDC provides THREE members which draw 3D edges
and/or
> > rectangles. How many does Graphics in C# provide? I see
none. > > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:eb**************@TK2MSFTNGP09.phx.gbl...
> > > The scenario that I had in mind was you have to use a DLL that is
> already
> > on
> > > a user's machine. You are required to coexist with a larger
and older
> MFC
> > > based program. Most of what you need is in one of its DLLs.

Perhaps
> that
> > > DLL has tools for accessing a file format that you have no

control or
> > > knowledge of. I have had to put up with that many times.
Good luck.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in
message > > > news:hh*********************@twister.austin.rr.com ...
> > > > Oh yeah, one other thing... why on EARTH would you want to use > > > > MFC when you have .NET now? I can't even fathom the

concept...!!
> > > >
> > > > :)
> > > >
> > > > -c
> > > >
> > > >
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message > > > > news:Z8*********************@twister.austin.rr.com ...
> > > > > >How should I call functions in a MFC extension library
> > > > >
> > > > > That's difficult, but if it's a COM interface, it can be

done.
> > > > > Otherwise, you'll have to use Managed Extensions for C++ to make
> > > > > a wrapper.
> > > > >
> > > > > That's not a fair criticism of C#, really, because you
can't > > > > > use .NET assemblies in C++ either.
> > > > >
> > > > > > What would be the equivalent of pure virtual functions
> > > > >
> > > > > Abstract classes and methods
> > > > >
> > > > > > and multiple derivation
> > > > >
> > > > > Multiple inheritence, you mean? There was a concious

decision
> > > > > not to support MI in .NET because ... well, that's a very long
> > > > > debate, but it's not because they couldn't do it, it's

because
> > > > > they didn't want to do it and felt it was wrong to do
it. > > > > >
> > > > > Let's turn the tables...
> > > > >
> > > > > What if I wanted didn't want to do any of my memory

management
> > > > > in C++?
> > > > >
> > > > > What if I wanted to have a comprehensive framework library with
> > > > > nearly everything you could want built in and supported
by > > > > > the runtime and compiler?
> > > > >
> > > > > What if I wanted to make my code cross-platform without any > > > > > fancy magic or special #defines?
> > > > >
> > > > > What if I wanted a pure OO language without any legacy
> > > > > baggage?
> > > > >
> > > > > -c
> > > > >
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message
> > > > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > > > Great. How should I call functions in a MFC extension

library.
> > > > Such
> > > > > a
> > > > > > library might have functions taking as parameters and/or returning
> > > > > CStrings
> > > > > > and CWnds. (Or for that matter a generic C++ style

class.)
What
> > > > > would be
> > > > > > the equivalent of pure virtual functions and multiple
derivation?
> I
> > > > > am
> > > > > > sorry, but the jury is still out.
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in

message
> > > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > > > JIT applies to all .NET assemblies, not just C#.

Remember,
.NET
> > > > > > > is a system, C# is merely a language on top of it.
> > > > > > >
> > > > > > > As far as C# being castrated, to me, it seems like has all the
> > > > > > > good stuff and almost none of the bad of C++. To
each his own,
> > > > > > > I guess.
> > > > > > >
> > > > > > > They're adding Generics in C# for .NET 2.0 which are

similar
> > > > > > > to Templates in C++.
> > > > > > >
> > > > > > > As far as finding things C++ does better than .NET,

you'll
> > > > > > > have a hard time. In all but the most contrived
> ultra-performance
> > > > > > > scenarios, .NET has many advantages over unmanaged
C/C++ code.
> > > > > > >
> > > > > > > Check this out:
> > > > > > > http://tinyurl.com/3890 [MSDN article]
> > > > > > >
> > > > > > > In many cases, because IL is JIT'd, it runs faster
than > > > > > > > equivalent unmanaged code because the JIT can better

determine
> > > > > > > at run-time which optimizations will have the most

impact.
> > > > > > >
> > > > > > > -c
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > > > Would JIT apply to a local executable? I do not

anticipate
> > > > doing
> > > > > any
> > > > > > > web
> > > > > > > > stuff for a while. I am looking at doing some
things that I
> > > > think
> > > > > > > that C++
> > > > > > > > is better equipped for than C# (which seems to be
castrated).
> > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > "Grant Richins [MS]"
<gr*****@online.microsoft.com> wrote in
> > > > > message
> > > > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > The C# compiler does not inline functions.
However, the
> .NET
> > > > > > > runtime/JIT
> > > > > > > > is
> > > > > > > > > allowed to inline functions, and often does.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > --Grant
> > > > > > > > > This posting is provided "AS IS" with no
warranties, and
> > > > confers
> > > > > no
> > > > > > > > rights.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Will Pittenger" <wi************@verizon.net>
wrote in
> message
> > > > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > > Does C# inline functions? I do not see a

inline keyword.
> > > > Is
> > > > > > > there an
> > > > > > > > > > implicit inline? Can the compiler select

functions for
> > > > > > > auto-inlining?
> > > > > > > > I
> > > > > > > > > am
> > > > > > > > > > more used to C++ where all these things are

possible.
> > > > > > > > > > ----------
> > > > > > > > > > Will Pittenger
> > > > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #27
You could (and should) multithread the application so that it is possible to
deal with input at the same time as painting. You could even turn the
painting priority down in comparison to the input priority. This doesn't
make the painting faster, but it gets around your crash into the
mountain/other boat scenario.

Niall

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here is another hypothetical scenario for you, also based on real world
experience:

You are working on a computer program that will fly airplanes. One program, running on just one computer (with perhaps backups that do nothing unless
there is a major problem) displays a map of where you are and routes
commands from the controls to the flight system. (The stick and rudder
pedal are just computer controls, like on many modern aircraft.) You have
to update the screen quickly so the pilot knows where he or she is.
However, you do not want to spend any serious amount of time (as measured in a percentage of CPU cycles used) painting the screen. If you spend too much time painting, the airplane could be headed towards a big mountain, but
never responds to the pilot's attempt to turn it away from that mountain
because it is too busy updating the screen. If you are a passenger on that plane, what do you want updating the screen: Windows GDI, MFC, C# and
Graphics, OpenGL, or DirectX? If a fancy look were important, you might
vote for DirectX or OpenGL. But with lives on the line, you very quickly
consider fancy graphics to be extra baggage. At that point, I vote for the Windows GDI. Now if .NET implements its stuff at a lower level than I have the impression that it does, perhaps it would work. Not otherwise.

Now in a real airplane, there would be many computers to drive just the
displays. The controls would be on a second set of systems. Still, we ran into that problem where the software runs boats. We were not talking about something that sold for hundreds of million of dollars. Customers spent
only a small fraction of their money on the computers and software. A
luxurious interior is typically more important. You get one computer, and
you are lucky if it is a top of the line laptop. Most of the marine worthy laptops are slow even new even compared to just other laptops.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
>How should I call functions in a MFC extension library

That's difficult, but if it's a COM interface, it can be done.
Otherwise, you'll have to use Managed Extensions for C++ to make
a wrapper.

That's not a fair criticism of C#, really, because you can't
use .NET assemblies in C++ either.

> What would be the equivalent of pure virtual functions

Abstract classes and methods

> and multiple derivation

Multiple inheritence, you mean? There was a concious decision
not to support MI in .NET because ... well, that's a very long
debate, but it's not because they couldn't do it, it's because
they didn't want to do it and felt it was wrong to do it.

Let's turn the tables...

What if I wanted didn't want to do any of my memory management
in C++?

What if I wanted to have a comprehensive framework library with
nearly everything you could want built in and supported by
the runtime and compiler?

What if I wanted to make my code cross-platform without any
fancy magic or special #defines?

What if I wanted a pure OO language without any legacy
baggage?

-c
"Will Pittenger" <wi************@verizon.net> wrote in message
news:u9****************@TK2MSFTNGP09.phx.gbl...
> Great. How should I call functions in a MFC extension library.

Such
a
> library might have functions taking as parameters and/or returning
CStrings
> and CWnds. (Or for that matter a generic C++ style class.) What
would be
> the equivalent of pure virtual functions and multiple derivation? I
am
> sorry, but the jury is still out.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:AK*********************@twister.austin.rr.com ...
> > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > is a system, C# is merely a language on top of it.
> >
> > As far as C# being castrated, to me, it seems like has all the
> > good stuff and almost none of the bad of C++. To each his own,
> > I guess.
> >
> > They're adding Generics in C# for .NET 2.0 which are similar
> > to Templates in C++.
> >
> > As far as finding things C++ does better than .NET, you'll
> > have a hard time. In all but the most contrived ultra-performance
> > scenarios, .NET has many advantages over unmanaged C/C++ code.
> >
> > Check this out:
> > http://tinyurl.com/3890 [MSDN article]
> >
> > In many cases, because IL is JIT'd, it runs faster than
> > equivalent unmanaged code because the JIT can better determine
> > at run-time which optimizations will have the most impact.
> >
> > -c
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > Would JIT apply to a local executable? I do not anticipate

doing
any
> > web
> > > stuff for a while. I am looking at doing some things that I

think
> > that C++
> > > is better equipped for than C# (which seems to be castrated).
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
message
> > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > The C# compiler does not inline functions. However, the .NET
> > runtime/JIT
> > > is
> > > > allowed to inline functions, and often does.
> > > >
> > > > --
> > > > --Grant
> > > > This posting is provided "AS IS" with no warranties, and

confers
no
> > > rights.
> > > >
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > Does C# inline functions? I do not see a inline keyword.

Is
> > there an
> > > > > implicit inline? Can the compiler select functions for
> > auto-inlining?
> > > I
> > > > am
> > > > > more used to C++ where all these things are possible.
> > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #28
Not really. The applications like that I worked on were multi-threaded. If
the drawing was too slow, the CPU was still unavailable because of Windows'
problems pre-empting threads. From what I understand, Unix and possibly
Linux would solve that problem, but the typically users of that kind of
application have no idea what the difference between a parallel cable and a
USB cable is. Do not even think of attempting to get them to understand
Unix. You would have a nightmare of a technical support problem.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Niall" <as**@me.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
You could (and should) multithread the application so that it is possible to deal with input at the same time as painting. You could even turn the
painting priority down in comparison to the input priority. This doesn't
make the painting faster, but it gets around your crash into the
mountain/other boat scenario.

Niall

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here is another hypothetical scenario for you, also based on real world
experience:

You are working on a computer program that will fly airplanes. One program,
running on just one computer (with perhaps backups that do nothing unless there is a major problem) displays a map of where you are and routes
commands from the controls to the flight system. (The stick and rudder
pedal are just computer controls, like on many modern aircraft.) You have to update the screen quickly so the pilot knows where he or she is.
However, you do not want to spend any serious amount of time (as measured in
a percentage of CPU cycles used) painting the screen. If you spend too

much
time painting, the airplane could be headed towards a big mountain, but
never responds to the pilot's attempt to turn it away from that mountain
because it is too busy updating the screen. If you are a passenger on

that
plane, what do you want updating the screen: Windows GDI, MFC, C# and
Graphics, OpenGL, or DirectX? If a fancy look were important, you might
vote for DirectX or OpenGL. But with lives on the line, you very

quickly consider fancy graphics to be extra baggage. At that point, I vote for

the
Windows GDI. Now if .NET implements its stuff at a lower level than I

have
the impression that it does, perhaps it would work. Not otherwise.

Now in a real airplane, there would be many computers to drive just the
displays. The controls would be on a second set of systems. Still, we

ran
into that problem where the software runs boats. We were not talking

about
something that sold for hundreds of million of dollars. Customers spent
only a small fraction of their money on the computers and software. A
luxurious interior is typically more important. You get one computer, and you are lucky if it is a top of the line laptop. Most of the marine

worthy
laptops are slow even new even compared to just other laptops.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
Oh yeah, one other thing... why on EARTH would you want to use
MFC when you have .NET now? I can't even fathom the concept...!!

:)

-c
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:Z8*********************@twister.austin.rr.com ...
> >How should I call functions in a MFC extension library
>
> That's difficult, but if it's a COM interface, it can be done.
> Otherwise, you'll have to use Managed Extensions for C++ to make
> a wrapper.
>
> That's not a fair criticism of C#, really, because you can't
> use .NET assemblies in C++ either.
>
> > What would be the equivalent of pure virtual functions
>
> Abstract classes and methods
>
> > and multiple derivation
>
> Multiple inheritence, you mean? There was a concious decision
> not to support MI in .NET because ... well, that's a very long
> debate, but it's not because they couldn't do it, it's because
> they didn't want to do it and felt it was wrong to do it.
>
> Let's turn the tables...
>
> What if I wanted didn't want to do any of my memory management
> in C++?
>
> What if I wanted to have a comprehensive framework library with
> nearly everything you could want built in and supported by
> the runtime and compiler?
>
> What if I wanted to make my code cross-platform without any
> fancy magic or special #defines?
>
> What if I wanted a pure OO language without any legacy
> baggage?
>
> -c
>
>
> "Will Pittenger" <wi************@verizon.net> wrote in message
> news:u9****************@TK2MSFTNGP09.phx.gbl...
> > Great. How should I call functions in a MFC extension library.
Such
> a
> > library might have functions taking as parameters and/or returning
> CStrings
> > and CWnds. (Or for that matter a generic C++ style class.) What
> would be
> > the equivalent of pure virtual functions and multiple derivation? I > am
> > sorry, but the jury is still out.
> > ----------
> > Will Pittenger
> > E-Mail: mailto:wi************@verizon.net
> > All mail filtered by Qurb (www.qurb.com)
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:AK*********************@twister.austin.rr.com ...
> > > JIT applies to all .NET assemblies, not just C#. Remember, .NET
> > > is a system, C# is merely a language on top of it.
> > >
> > > As far as C# being castrated, to me, it seems like has all the
> > > good stuff and almost none of the bad of C++. To each his own,
> > > I guess.
> > >
> > > They're adding Generics in C# for .NET 2.0 which are similar
> > > to Templates in C++.
> > >
> > > As far as finding things C++ does better than .NET, you'll
> > > have a hard time. In all but the most contrived ultra-performance > > > scenarios, .NET has many advantages over unmanaged C/C++ code.
> > >
> > > Check this out:
> > > http://tinyurl.com/3890 [MSDN article]
> > >
> > > In many cases, because IL is JIT'd, it runs faster than
> > > equivalent unmanaged code because the JIT can better determine
> > > at run-time which optimizations will have the most impact.
> > >
> > > -c
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > Would JIT apply to a local executable? I do not anticipate
doing
> any
> > > web
> > > > stuff for a while. I am looking at doing some things that I
think
> > > that C++
> > > > is better equipped for than C# (which seems to be castrated).
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in
> message
> > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > The C# compiler does not inline functions. However, the ..NET > > > runtime/JIT
> > > > is
> > > > > allowed to inline functions, and often does.
> > > > >
> > > > > --
> > > > > --Grant
> > > > > This posting is provided "AS IS" with no warranties, and
confers
> no
> > > > rights.
> > > > >
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > Does C# inline functions? I do not see a inline keyword.
Is
> > > there an
> > > > > > implicit inline? Can the compiler select functions for
> > > auto-inlining?
> > > > I
> > > > > am
> > > > > > more used to C++ where all these things are possible.
> > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #29
What problems pre-empting threads? I've seen some damn-near
real time apps run on Windows without any pre-empting problems.

With a finely tuned app that's aware of thread priorities and
quanta guidelines, you can get it to behave pretty well.

Such optimizations would be required on Unix as well.

As far as Linux... if you suggest Linux's threading/proc model
is better than Windows, perhaps you should read some more.

Keep in mind Windows == Windows NT/2K/XP/2K3.

Windows 9x is heretofore referred to as the Bastard Spawn of Hell.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
Not really. The applications like that I worked on were multi-threaded. If the drawing was too slow, the CPU was still unavailable because of Windows' problems pre-empting threads. From what I understand, Unix and possibly Linux would solve that problem, but the typically users of that kind of application have no idea what the difference between a parallel cable and a USB cable is. Do not even think of attempting to get them to understand Unix. You would have a nightmare of a technical support problem.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Niall" <as**@me.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
You could (and should) multithread the application so that it is possible
to
deal with input at the same time as painting. You could even turn the painting priority down in comparison to the input priority. This doesn't make the painting faster, but it gets around your crash into the
mountain/other boat scenario.

Niall

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here is another hypothetical scenario for you, also based on real world experience:

You are working on a computer program that will fly airplanes. One
program,
running on just one computer (with perhaps backups that do nothing unless there is a major problem) displays a map of where you are and
routes commands from the controls to the flight system. (The stick and rudder pedal are just computer controls, like on many modern aircraft.) You
have to update the screen quickly so the pilot knows where he or she
is. However, you do not want to spend any serious amount of time (as
measured
in
a percentage of CPU cycles used) painting the screen. If you spend too much
time painting, the airplane could be headed towards a big
mountain, but never responds to the pilot's attempt to turn it away from that mountain because it is too busy updating the screen. If you are a passenger on that
plane, what do you want updating the screen: Windows GDI, MFC, C#
and Graphics, OpenGL, or DirectX? If a fancy look were important, you might vote for DirectX or OpenGL. But with lives on the line, you very

quickly consider fancy graphics to be extra baggage. At that point, I vote for the
Windows GDI. Now if .NET implements its stuff at a lower level
than I
have
the impression that it does, perhaps it would work. Not
otherwise.
Now in a real airplane, there would be many computers to drive just the displays. The controls would be on a second set of systems. Still, we ran
into that problem where the software runs boats. We were not
talking about
something that sold for hundreds of million of dollars. Customers
spent only a small fraction of their money on the computers and software. A luxurious interior is typically more important. You get one computer, and you are lucky if it is a top of the line laptop. Most of the
marine worthy
laptops are slow even new even compared to just other laptops.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:hh*********************@twister.austin.rr.com ...
> Oh yeah, one other thing... why on EARTH would you want to use
> MFC when you have .NET now? I can't even fathom the concept...!!
>
> :)
>
> -c
>
>
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:Z8*********************@twister.austin.rr.com ...
> > >How should I call functions in a MFC extension library
> >
> > That's difficult, but if it's a COM interface, it can be done.
> > Otherwise, you'll have to use Managed Extensions for C++ to
make > > a wrapper.
> >
> > That's not a fair criticism of C#, really, because you can't
> > use .NET assemblies in C++ either.
> >
> > > What would be the equivalent of pure virtual functions
> >
> > Abstract classes and methods
> >
> > > and multiple derivation
> >
> > Multiple inheritence, you mean? There was a concious decision
> > not to support MI in .NET because ... well, that's a very long
> > debate, but it's not because they couldn't do it, it's because
> > they didn't want to do it and felt it was wrong to do it.
> >
> > Let's turn the tables...
> >
> > What if I wanted didn't want to do any of my memory management
> > in C++?
> >
> > What if I wanted to have a comprehensive framework library with > > nearly everything you could want built in and supported by
> > the runtime and compiler?
> >
> > What if I wanted to make my code cross-platform without any
> > fancy magic or special #defines?
> >
> > What if I wanted a pure OO language without any legacy
> > baggage?
> >
> > -c
> >
> >
> > "Will Pittenger" <wi************@verizon.net> wrote in message
> > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > Great. How should I call functions in a MFC extension library. > Such
> > a
> > > library might have functions taking as parameters and/or returning > > CStrings
> > > and CWnds. (Or for that matter a generic C++ style class.) What > > would be
> > > the equivalent of pure virtual functions and multiple derivation? I > > am
> > > sorry, but the jury is still out.
> > > ----------
> > > Will Pittenger
> > > E-Mail: mailto:wi************@verizon.net
> > > All mail filtered by Qurb (www.qurb.com)
> > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in
message > > > news:AK*********************@twister.austin.rr.com ...
> > > > JIT applies to all .NET assemblies, not just C#. Remember, ..NET > > > > is a system, C# is merely a language on top of it.
> > > >
> > > > As far as C# being castrated, to me, it seems like has all the > > > > good stuff and almost none of the bad of C++. To each his own, > > > > I guess.
> > > >
> > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > to Templates in C++.
> > > >
> > > > As far as finding things C++ does better than .NET, you'll
> > > > have a hard time. In all but the most contrived
ultra-performance > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > >
> > > > Check this out:
> > > > http://tinyurl.com/3890 [MSDN article]
> > > >
> > > > In many cases, because IL is JIT'd, it runs faster than
> > > > equivalent unmanaged code because the JIT can better determine > > > > at run-time which optimizations will have the most impact.
> > > >
> > > > -c
> > > >
> > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > Would JIT apply to a local executable? I do not anticipate > doing
> > any
> > > > web
> > > > > stuff for a while. I am looking at doing some things that I > think
> > > > that C++
> > > > > is better equipped for than C# (which seems to be castrated). > > > > > ----------
> > > > > Will Pittenger
> > > > > E-Mail: mailto:wi************@verizon.net
> > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > message
> > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > The C# compiler does not inline functions. However, the .NET
> > > > runtime/JIT
> > > > > is
> > > > > > allowed to inline functions, and often does.
> > > > > >
> > > > > > --
> > > > > > --Grant
> > > > > > This posting is provided "AS IS" with no warranties,
and > confers
> > no
> > > > > rights.
> > > > > >
> > > > > >
> > > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > Does C# inline functions? I do not see a inline keyword. > Is
> > > > there an
> > > > > > > implicit inline? Can the compiler select functions for > > > > auto-inlining?
> > > > > I
> > > > > > am
> > > > > > > more used to C++ where all these things are possible. > > > > > > > ----------
> > > > > > > Will Pittenger
> > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #30
A program whose drawing code is not efficient is not a "finely tuned app
that's aware of thread priorities and quanta guidelines" application. You
proved my point.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:cw*********************@twister.austin.rr.com ...
What problems pre-empting threads? I've seen some damn-near
real time apps run on Windows without any pre-empting problems.

With a finely tuned app that's aware of thread priorities and
quanta guidelines, you can get it to behave pretty well.

Such optimizations would be required on Unix as well.

As far as Linux... if you suggest Linux's threading/proc model
is better than Windows, perhaps you should read some more.

Keep in mind Windows == Windows NT/2K/XP/2K3.

Windows 9x is heretofore referred to as the Bastard Spawn of Hell.

-c

"Will Pittenger" <wi************@verizon.net> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
Not really. The applications like that I worked on were

multi-threaded. If
the drawing was too slow, the CPU was still unavailable because of

Windows'
problems pre-empting threads. From what I understand, Unix and

possibly
Linux would solve that problem, but the typically users of that kind

of
application have no idea what the difference between a parallel cable

and a
USB cable is. Do not even think of attempting to get them to

understand
Unix. You would have a nightmare of a technical support problem.
----------
Will Pittenger
E-Mail: mailto:wi************@verizon.net
All mail filtered by Qurb (www.qurb.com)
"Niall" <as**@me.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
You could (and should) multithread the application so that it is possible
to
deal with input at the same time as painting. You could even turn

the painting priority down in comparison to the input priority. This doesn't make the painting faster, but it gets around your crash into the
mountain/other boat scenario.

Niall

"Will Pittenger" <wi************@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Here is another hypothetical scenario for you, also based on real world > experience:
>
> You are working on a computer program that will fly airplanes. One program,
> running on just one computer (with perhaps backups that do nothing

unless
> there is a major problem) displays a map of where you are and routes > commands from the controls to the flight system. (The stick and rudder > pedal are just computer controls, like on many modern aircraft.) You
have
> to update the screen quickly so the pilot knows where he or she

is. > However, you do not want to spend any serious amount of time (as

measured
in
> a percentage of CPU cycles used) painting the screen. If you spend too much
> time painting, the airplane could be headed towards a big mountain, but > never responds to the pilot's attempt to turn it away from that mountain > because it is too busy updating the screen. If you are a passenger on that
> plane, what do you want updating the screen: Windows GDI, MFC, C# and > Graphics, OpenGL, or DirectX? If a fancy look were important, you might > vote for DirectX or OpenGL. But with lives on the line, you very

quickly
> consider fancy graphics to be extra baggage. At that point, I vote for the
> Windows GDI. Now if .NET implements its stuff at a lower level than I have
> the impression that it does, perhaps it would work. Not otherwise. >
> Now in a real airplane, there would be many computers to drive just the > displays. The controls would be on a second set of systems. Still, we ran
> into that problem where the software runs boats. We were not talking about
> something that sold for hundreds of million of dollars. Customers spent > only a small fraction of their money on the computers and software. A > luxurious interior is typically more important. You get one computer,
and
> you are lucky if it is a top of the line laptop. Most of the

marine worthy
> laptops are slow even new even compared to just other laptops.
> ----------
> Will Pittenger
> E-Mail: mailto:wi************@verizon.net
> All mail filtered by Qurb (www.qurb.com)
> "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> news:hh*********************@twister.austin.rr.com ...
> > Oh yeah, one other thing... why on EARTH would you want to use
> > MFC when you have .NET now? I can't even fathom the concept...!!
> >
> > :)
> >
> > -c
> >
> >
> > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
> > news:Z8*********************@twister.austin.rr.com ...
> > > >How should I call functions in a MFC extension library
> > >
> > > That's difficult, but if it's a COM interface, it can be done.
> > > Otherwise, you'll have to use Managed Extensions for C++ to make > > > a wrapper.
> > >
> > > That's not a fair criticism of C#, really, because you can't
> > > use .NET assemblies in C++ either.
> > >
> > > > What would be the equivalent of pure virtual functions
> > >
> > > Abstract classes and methods
> > >
> > > > and multiple derivation
> > >
> > > Multiple inheritence, you mean? There was a concious decision
> > > not to support MI in .NET because ... well, that's a very long
> > > debate, but it's not because they couldn't do it, it's because
> > > they didn't want to do it and felt it was wrong to do it.
> > >
> > > Let's turn the tables...
> > >
> > > What if I wanted didn't want to do any of my memory management
> > > in C++?
> > >
> > > What if I wanted to have a comprehensive framework library with > > > nearly everything you could want built in and supported by
> > > the runtime and compiler?
> > >
> > > What if I wanted to make my code cross-platform without any
> > > fancy magic or special #defines?
> > >
> > > What if I wanted a pure OO language without any legacy
> > > baggage?
> > >
> > > -c
> > >
> > >
> > > "Will Pittenger" <wi************@verizon.net> wrote in message
> > > news:u9****************@TK2MSFTNGP09.phx.gbl...
> > > > Great. How should I call functions in a MFC extension library. > > Such
> > > a
> > > > library might have functions taking as parameters and/or returning > > > CStrings
> > > > and CWnds. (Or for that matter a generic C++ style class.) What > > > would be
> > > > the equivalent of pure virtual functions and multiple derivation?
I
> > > am
> > > > sorry, but the jury is still out.
> > > > ----------
> > > > Will Pittenger
> > > > E-Mail: mailto:wi************@verizon.net
> > > > All mail filtered by Qurb (www.qurb.com)
> > > > "Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in

message > > > > news:AK*********************@twister.austin.rr.com ...
> > > > > JIT applies to all .NET assemblies, not just C#. Remember, .NET > > > > > is a system, C# is merely a language on top of it.
> > > > >
> > > > > As far as C# being castrated, to me, it seems like has all the > > > > > good stuff and almost none of the bad of C++. To each his own, > > > > > I guess.
> > > > >
> > > > > They're adding Generics in C# for .NET 2.0 which are similar > > > > > to Templates in C++.
> > > > >
> > > > > As far as finding things C++ does better than .NET, you'll
> > > > > have a hard time. In all but the most contrived

ultra-performance
> > > > > scenarios, .NET has many advantages over unmanaged C/C++ code. > > > > >
> > > > > Check this out:
> > > > > http://tinyurl.com/3890 [MSDN article]
> > > > >
> > > > > In many cases, because IL is JIT'd, it runs faster than
> > > > > equivalent unmanaged code because the JIT can better determine > > > > > at run-time which optimizations will have the most impact.
> > > > >
> > > > > -c
> > > > >
> > > > > "Will Pittenger" <wi************@verizon.net> wrote in message > > > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > > Would JIT apply to a local executable? I do not anticipate > > doing
> > > any
> > > > > web
> > > > > > stuff for a while. I am looking at doing some things that I > > think
> > > > > that C++
> > > > > > is better equipped for than C# (which seems to be castrated). > > > > > > ----------
> > > > > > Will Pittenger
> > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > "Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in > > > message
> > > > > > news:O9***************@TK2MSFTNGP12.phx.gbl...
> > > > > > > The C# compiler does not inline functions. However, the
.NET
> > > > > runtime/JIT
> > > > > > is
> > > > > > > allowed to inline functions, and often does.
> > > > > > >
> > > > > > > --
> > > > > > > --Grant
> > > > > > > This posting is provided "AS IS" with no warranties,

and > > confers
> > > no
> > > > > > rights.
> > > > > > >
> > > > > > >
> > > > > > > "Will Pittenger" <wi************@verizon.net> wrote in

message
> > > > > > > news:ur**************@TK2MSFTNGP09.phx.gbl...
> > > > > > > > Does C# inline functions? I do not see a inline keyword. > > Is
> > > > > there an
> > > > > > > > implicit inline? Can the compiler select functions for > > > > > auto-inlining?
> > > > > > I
> > > > > > > am
> > > > > > > > more used to C++ where all these things are possible. > > > > > > > > ----------
> > > > > > > > Will Pittenger
> > > > > > > > E-Mail: mailto:wi************@verizon.net
> > > > > > > > All mail filtered by Qurb (www.qurb.com)
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #31

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by A | last post: by
14 posts views Thread by Chris Mantoulidis | last post: by
47 posts views Thread by Richard Hayden | last post: by
7 posts views Thread by Srini | last post: by
4 posts views Thread by Tony Johansson | last post: by
7 posts views Thread by Alvin | last post: by
43 posts views Thread by Patrick Laurent | last post: by
18 posts views Thread by Method Man | last post: by
12 posts views Thread by sam_cit | last post: by
2 posts views Thread by aaragon | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.