473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Just a liitle question abou VC++ and MFC

HI,

I'm using a MSVC++ 7.0 with MFC.

Let'ssay I created a class derived from CStatic:

class Card : CStatic
{
......
}

Now, i want to use one in my CView loading a card.dll.

So what I'm doing:
CCView::OnDraw(CDC* pDC)
{
card = new CCard();
hModule = LoadLibrary("cards.dll");
card->Create("", WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE
,CRect(10, 10, 82, 107), this);
card->SetBitmap(::LoadBitmap(hModule,MAKEINTRESOURCE(ca rd->CardNumber)));
.....
}

but its now working. Will you set me by right way?
Idea is simple. We have a control CCard and want to engage in CView
with proper bitmap getting from cards.dll

Thanks in advance.
Jul 23 '05 #1
14 1654

"SignOff" <al*****************@gmail.com> wrote in message
news:f0**************************@posting.google.c om...
HI,

I'm using a MSVC++ 7.0 with MFC.

Let'ssay I created a class derived from CStatic:
[snip]
... Will you set me by right way?


Nope, but someone on an mfc newsgroup might. Try microsoft.public.vc.mfc
(you may want to use their server: msnews.microsoft.com).

-Howard
Jul 23 '05 #2

"SignOff" <al*****************@gmail.com> wrote in message
news:f0**************************@posting.google.c om...
HI,

I'm using a MSVC++ 7.0 with MFC.

Let'ssay I created a class derived from CStatic:

class Card : CStatic
{
.....
}

Now, i want to use one in my CView loading a card.dll.

So what I'm doing:
CCView::OnDraw(CDC* pDC)
{
card = new CCard();
hModule = LoadLibrary("cards.dll");
card->Create("", WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE
,CRect(10, 10, 82, 107), this);
card->SetBitmap(::LoadBitmap(hModule,MAKEINTRESOURCE(ca rd->CardNumber))); ....
}

but its now working. Will you set me by right way?
Idea is simple. We have a control CCard and want to engage in CView
with proper bitmap getting from cards.dll


What's the error? Are you trying to use something from the CStatic
when Card is derived privately? If so, try

class Card : public CStatic {

If you don't specify public here, it defaults to private. If this isn't
your problem,
you should indicate your error.

Jul 23 '05 #3
SignOff wrote:
HI,

I'm using a MSVC++ 7.0 with MFC.

Let'ssay I created a class derived from CStatic:

Microsoft MFC is an abomination when it comes to C++
OO design. Most of the functions you think ought to
be virtual AREN'T, it uses the message maps to invoke
the derived class functions directly.

This is all off-topic here, read a good book on MFC
Jul 23 '05 #4
On Mon, 16 May 2005 20:51:26 -0400, Ron Natalie <ro*@spamcop.net>
wrote:
Microsoft MFC is an abomination when it comes to C++
OO design. Most of the functions you think ought to
be virtual AREN'T, it uses the message maps to invoke
the derived class functions directly.


100% agreed that it is much better to spend years designing a
beautiful library with lots of templates, huge vtables that map every
message, infinite configurability, and standards conformance that
makes it look like pig and run like a hog on every platform.
Jul 23 '05 #5
Code4u wrote:
On Mon, 16 May 2005 20:51:26 -0400, Ron Natalie <ro*@spamcop.net>
wrote:

Microsoft MFC is an abomination when it comes to C++
OO design. Most of the functions you think ought to
be virtual AREN'T, it uses the message maps to invoke
the derived class functions directly.

100% agreed that it is much better to spend years designing a
beautiful library with lots of templates, huge vtables that map every
message, infinite configurability, and standards conformance that
makes it look like pig and run like a hog on every platform.


Are you trying to tell me that MFC is more efficient than if it
had a scant amount of OO design in it? I don't agree.
Jul 23 '05 #6
Code4u wrote:
On Mon, 16 May 2005 20:51:26 -0400, Ron Natalie <ro*@spamcop.net>
wrote:

Microsoft MFC is an abomination when it comes to C++
OO design. Most of the functions you think ought to
be virtual AREN'T, it uses the message maps to invoke
the derived class functions directly.

100% agreed that it is much better to spend years designing a
beautiful library with lots of templates, huge vtables that map every
message, infinite configurability, and standards conformance that
makes it look like pig and run like a hog on every platform.


Microsoft can do OO right and efficiently. Take a look at GDI+.
Unlike it's cousin the MFC wrappers for the GDI primitives, it
actually appears someone knew how to program in C++ prior to writing
it.
Jul 23 '05 #7
Ron Natalie wrote:
Microsoft can do OO right and efficiently. Take a look at GDI+.
Unlike it's cousin the MFC wrappers for the GDI primitives, it
actually appears someone knew how to program in C++ prior to writing
it.

As far as I know GDI+ is a subset of .NET. .NET is nicely OO with multiple inheritance to
be available only through interfaces though (which is sufficient for most cases of
application programming I think).
--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #8
Ioannis Vranos wrote:

As far as I know GDI+ is a subset of .NET

GDI+ isn't really part of .NET, but .NET uses it.

Microsoft has evolved in the 15 years or so MFC has been
around. Much of their newer stuff is much better than
the the relics from the DOS days :-)
Jul 23 '05 #9
On Tue, 17 May 2005 09:26:11 -0400, Ron Natalie <ro*@spamcop.net>
wrote:
GDI+ isn't really part of .NET, but .NET uses it.

Microsoft has evolved in the 15 years or so MFC has been
around. Much of their newer stuff is much better than
the the relics from the DOS days :-)


In all seriousness, I have a lot of experience with MFC, it's ugly in
places, but it gets the job done and scales up very well. As a
framework it is very flexible, if you don't like the way part of MFC
works you're free to derive your own classes and roll your own, or mix
and match with win32/ATL/WTL for example. Regarding message maps, this
implementation is very efficient, you don't pay for what you don't use
and there is very little run-time overhead. We're way off-topic here,
but I'll end by saying that although .NET has some good design, it's
still a buggy mess in places, this comes straight from the mouth of
Jeff Richter. For example, interop code cannot be debugged because
Visual Studio doesn't transition from managed to unmanaged code well.
Bottom line is MFC is solid, reliable, has source code available, is
extensible and has a huge knowledge base. Beautiful design is just one
factor to be considered and is often prioritized too highly by the
inexperienced.
Jul 23 '05 #10
Code4u wrote:
Regarding message maps, this
implementation is very efficient, you don't pay for what you don't use
and there is very little run-time overhead.


Chortle. If you have anythign beyond a trivial application, the
stupid-assed MFC command mapping is FAR from efficient. I've got
so manu things in the message map for the main window in my applicaiton
that VC++ 6's class wizard gags and refuses to interpret it.

Ever trace through what happens during ON_COMMAND processing? It's
laughable.
Jul 23 '05 #11
Ron Natalie wrote:
GDI+ isn't really part of .NET, but .NET uses it.

Do you mean that .NET provides a managed wrapper of it, while it is available in native form?

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #12
Ioannis Vranos wrote:
Ron Natalie wrote:
GDI+ isn't really part of .NET, but .NET uses it.


Do you mean that .NET provides a managed wrapper of it, while it is
available in native form?

I believe that is the case...you can install the GDI+ dll's without
the .NET framework.

Jul 23 '05 #13
Ron Natalie wrote:
I believe that is the case...you can install the GDI+ dll's without
the .NET framework.

OK. :-)

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #14
Ron Natalie wrote:
I believe that is the case...you can install the GDI+ dll's without
the .NET framework.

I asked in an MS newsgroup and GDI+ is a native API indeed:

Is GDI+ a subset of .NET

No. GDI+ is a native API.

See: GDI+
http://msdn.microsoft.com/library/en...us/GDIPlus.asp
or does .NET just provide a managed wrapper of it?


Yes.

See: About GDI+ Managed Code
http://msdn.microsoft.com/library/en...Code_about.asp


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sanjeevp | last post by:
Hi, I am doing migration of MFC code from CV++.6 to VC++.NET . I found a difference between handing MFC "ON_COMMAND" message function prototype. In VC++ .6 the function prototype is BOOL...
0
by: R Tamilarasan | last post by:
Curiosity made me to install VC - 7 (.net) in my machine which had VC - 6 already installed. I tried to compile my workspace in VC - 7 but failed due to several compile time errors. ok no...
11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
2
by: S.S.Raja | last post by:
I learned from my friend, there are very less VC++ Developers all over the world and its very rare to find MCP or MCSD with VC++...is that true? can i get any specific information on this...like...
2
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory...
0
by: Abubakar | last post by:
Hi, I have made a visual c++ 2k5 unmanaged (consisting of WTL) app in windows 2000. Built it as "release". Its just not running on a windows xp machine. the error is: ---------------------------...
15
by: Michael Tissington | last post by:
I have a Visual Basic 6.0 ActiveX Control. It seems there is no way with VS 2005 to create a similar control for containers that host ActiverX controls, is this correct ? I'm thinking of...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.