473,383 Members | 1,788 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,383 software developers and data experts.

Visual C++: the need for MFC


Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?

Forget about the time and speed issue.

--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 8.04) Linux 2.6.25.6
^ ^ 20:42:01 up 2 days 10:36 2 users load average: 1.08 1.14 1.06
? ? (CSSA):
http://www.swd.gov.hk/tc/index/site_...ub_addressesa/
Jun 27 '08 #1
16 1925
On Jun 14, 1:44*pm, "Man-wai Chang ToDie (33.6k)"
<toylet.toy...@gmail.comwrote:
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?

Forget about the time and speed issue.
yes. For details ask in a microsoft ng.
eg. comp.os.ms-windows.programmer.win32
-- Nick Keighley
Jun 27 '08 #2
* Man-wai Chang ToDie (33.6k) peremptorily fired off this memo:
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?
Pick a cross-platform framework such as FLTK, wxWidgets, Qt, gtk++, or
others, and use that for developing a GUI.

You might see if there some open-source projects already out there that
work on Windows, to get a good code example.

--
When we have the information highway, I'll put it [information about
himself] out there. Everybody who wants to pay, I don't know, one cent, can
see what movies I'm watching and what books I'm reading and certain other
information. If I'm still interesting, I'll rack up dollars as people
access that part of the highway.
-- Bill Gates, Interview in Playboy magazine (1994)
Jun 27 '08 #3
Man-wai Chang ToDie (33.6k) wrote:
>
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?

Forget about the time and speed issue.
Well, the "wizard" of the lcc-win compiler generates
a skeleton for a GUI application complete with menu/main loop
window class registering/opening, etc with just a few clicks.

The output language is just C (NOT C++) so there is surely
no MFC involved.

You can download the lcc-win C compiler at no charge from
the address below.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jun 27 '08 #4
Man-wai Chang ToDie (33.6k) wrote:
>
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?
You can avoid using MFC by using the Win32 API directly, but you
*really* don't want to do that, believe me. Even creating the simplest
of dialogs using the Win32 API is a nightmare.

If you don't mind using alternative libraries, consider WTL or some of
the portable ones (such as wxwidgets).
Jun 27 '08 #5
Juha Nieminen wrote:
Man-wai Chang ToDie (33.6k) wrote:
>Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?

You can avoid using MFC by using the Win32 API directly, but you
*really* don't want to do that, believe me. Even creating the simplest
of dialogs using the Win32 API is a nightmare.
No, it is fairly easy, and you get used to it fairly quickly.

This horror story has been repeated at will by people that want to
promote this or that library.

I always use C for my dialogs. Suppose a dialog that asks for a number,
with two OK Cancel buttons.

The minimal code to handle that dialog is:
INT_PTR CALLBACK AskALine(HWND hDlg,MSGTYPE message,WPARAM wParam,LPARAM
lParam)
{
int i, c, line;
HWND hCB;
char tmpbuf[10];
switch (message) {
case WM_COMMAND:
switch (GETIDFROMWPARAM(wParam)) {
case IDOK:
GetDlgItemText(hDlg,IDGOTOLINENR, tmpbuf, 9);
if (!ValidateInteger(tmpbuf, &line))
return 1;
if (l <= 0)
break;
EndDialog(hDlg,line);
return 1;
}
}
return (HandleDefaultMessages(hDlg, message, wParam, lParam));
}

That is all. True, the "HandleDefaultMessages" procedure will
be a more complex one, but essentially that is ALL the code
you will want to write. And guess what?

That code was written for windows 3.1. And that code performs
perfectly under windows Vista 64 bits. It was "ported" from
16 bits to 32, and from 32 to 64. And it does NOT need anything
more than EXACTLY what you need.

But obviously I am wrong. Keeping it simple is no longer a
good strategy nowadays.
If you don't mind using alternative libraries, consider WTL or some of
the portable ones (such as wxwidgets).

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jun 27 '08 #6
jacob navia wrote:
I always use C for my dialogs. Suppose a dialog that asks for a number,
with two OK Cancel buttons.

The minimal code to handle that dialog is:
INT_PTR CALLBACK AskALine(HWND hDlg,MSGTYPE message,WPARAM wParam,LPARAM
lParam)
{
int i, c, line;
HWND hCB;
char tmpbuf[10];
switch (message) {
case WM_COMMAND:
switch (GETIDFROMWPARAM(wParam)) {
case IDOK:
GetDlgItemText(hDlg,IDGOTOLINENR, tmpbuf, 9);
if (!ValidateInteger(tmpbuf, &line))
return 1;
if (l <= 0)
break;
EndDialog(hDlg,line);
return 1;
}
}
return (HandleDefaultMessages(hDlg, message, wParam, lParam));
}
I fail to see where is it that you define the actual contents of the
dialog: Title bar text, dialog text and its location, a textfield (or
similar, to ask for the number) and its geometry, the amount and
contents of the buttons...

The only thing I see there is a callback function which handles
signals received by something.

Note that we are talking about Visual Studio Express here: AFAIK it
doesn't have fancy graphical window design editors. If you want to
create a new window type using the Win32 API, you'll have to write it
completely by hand. And, AFAIK, this is a real nightmare.
Jun 27 '08 #7
Juha Nieminen wrote:
jacob navia wrote:
>I always use C for my dialogs. Suppose a dialog that asks for a number,
with two OK Cancel buttons.

The minimal code to handle that dialog is:
INT_PTR CALLBACK AskALine(HWND hDlg,MSGTYPE message,WPARAM wParam,LPARAM
lParam)
{
int i, c, line;
HWND hCB;
char tmpbuf[10];
switch (message) {
case WM_COMMAND:
switch (GETIDFROMWPARAM(wParam)) {
case IDOK:
GetDlgItemText(hDlg,IDGOTOLINENR, tmpbuf, 9);
if (!ValidateInteger(tmpbuf, &line))
return 1;
if (l <= 0)
break;
EndDialog(hDlg,line);
return 1;
}
}
return (HandleDefaultMessages(hDlg, message, wParam, lParam));
}

I fail to see where is it that you define the actual contents of the
dialog: Title bar text, dialog text and its location, a textfield (or
similar, to ask for the number) and its geometry, the amount and
contents of the buttons...

The only thing I see there is a callback function which handles
signals received by something.

Note that we are talking about Visual Studio Express here: AFAIK it
doesn't have fancy graphical window design editors. If you want to
create a new window type using the Win32 API, you'll have to write it
completely by hand. And, AFAIK, this is a real nightmare.

Obviously you need a resource editor that generates the dialog template
for you.

Such an editor is present in the compiler system

lcc-win

or in many other compilers.

To do a simple dialog like the one I described you need
around 10 clicks of the mouse and it is all done.

You can download lcc-win at the URL below
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jun 27 '08 #8
On 15 Jun, 13:23, jacob navia <ja...@nospam.comwrote:
Juha Nieminen wrote:
Man-wai Chang ToDie (33.6k) wrote:
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?
* You can avoid using MFC by using the Win32 API directly, but you
*really* don't want to do that, believe me. Even creating the simplest
of dialogs using the Win32 API is a nightmare.

No, it is fairly easy, and you get used to it fairly quickly.

This horror story has been repeated at will by people that want to
promote this or that library.
Jocob is correct. Writing applications using in32 is not particularly
difficult.
--
Nick Keighley
Jun 27 '08 #9
In article <d6ac9a2d-fce0-4d88-bd8f-21fbae48d780
@m3g2000hsc.googlegroups.com>, ni******************@hotmail.com says...

[ ... ]
Jocob is correct. Writing applications using in32 is not particularly
difficult.
It isn't _particularly_ difficult, that's true.

OTOH, using the raw API, you have about 50 lines of code to register a
window class, create a window and make it visible. You have another 30-
40 lines for even an extremely minimal message processor. You have
another 25 lines for a message loop plus calling the above. If you want
an MDI application, roughly double all of those (i.e. you have to
register an extra window class, create not just two but three windows,
be ready to respond to messages to do things like cascade and tile the
child windows, etc.)

For beginners, this is rather intimidating: they have to write a couple
of hundred lines of code (or so) just to get to the point of a bare
minimum program that doesn't really even DO anything yet -- it just
creates an empty window that you can resize, minimize, maximize, etc.

For experienced programmers, it's no longer intimidating, but it is
repetitive and boring. Nearly the only reasonable alternative is to use
a library of one sort or another -- if you don't use a conventional
library of object code, then you use a "library" of source code from
which to cut and paste chunks of code to avoid retyping the same junk
over and over and over again.

The bottom line is that for most people's programs most of the time,
writing to the raw Win32 API is a pointless waste of time.

We now return you to your regularly scheduled (but topical) flaming...

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 27 '08 #10
jacob navia wrote:
3: Simplicity.
This one made me ROTFL.
Jun 27 '08 #11
jacob navia wrote:
Only those people that used the windows API are now able to develop
their applications without any problems now!
And they'll run only on Windows (Wine is a half-working hack, not a
robust platform.) Applications today are best developped in a
cross-platform way, this not only makes them easier ported to other
existing systems, it also makes them more portable towards future
developments just in the same way that writing in a higher-level
language compared to assembler will make your software more portable if
the industry moves on from processor type X to processor type Y.
Jun 27 '08 #12
Jerry Coffin wrote:
>MFC is obsolete and hasn't been updated for several YEARS now.

False! It was updated (significantly) for Visual Studio 2008 -- which is
to say within the last few months (note how I've used the exclamation
point to emphasize something that clearly is NOT known to many
developers).

MFC's last update was in 1998. Ten years passed and nothing was updated,
until now. I did not know about this new release. So, obviously a
library that is updated in a 10 YEAR basis is considered OK.

There is no point in discussing this further.

Use MFC. I will go on using the API.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jun 27 '08 #13
Man-wai Chang ToDie (33.6k) wrote:
>
Is it possible to build a Visual C++ GUI program without using MFC,
using VC++ 2008 Express Edition?

Forget about the time and speed issue.
Use WTL 8, it comes with a project wizard.
http://www.download.com/Windows-Temp...-10731539.html

But why do you wanna use Visual Studio 2008 Express? You have to also
deploy its redist package, which has so many installation problems and
they become your problems.

Jul 1 '08 #14
On Jun 17, 12:49*am, Jerry Coffin <jcof...@taeus.comwrote:
False! It was updated (significantly) for Visual Studio 2008 -- which is
to say within the last few months (note how I've used the exclamation
point to emphasize something that clearly is NOT known to many
developers).
Jerry needs no support from me but just to bolster his point, please
read the Visual C++ team blog's latest entry:
http://blogs.msdn.com/vcblog/archive...the-booth.aspx

The recent updates to MFC apparently was the talk of TechEd 2008.

Also, I don't know if Jerry knows about this but John Torjo's template
based C++-GUI library is also shaping up to be a fine competitor:
http://msdn.microsoft.com/en-us/magazine/cc534994.aspx
Jul 1 '08 #15
I suppose it depends on what you are after...

If you are developing your own applications, please see above posts.

Otherwise, if you are looking for a job in C/C++, then the above is
probably a moot point. It would then be prudent to learn MS or
whatever compiler would impress a potential employer these days.

Feedscrn
Jul 4 '08 #16
In article <22a707fe-d775-4a99-b3af-dd8ed82d5159
@r66g2000hsg.googlegroups.com>, rd*****@lycos.com says...
On Jun 17, 12:49Â*am, Jerry Coffin <jcof...@taeus.comwrote:
False! It was updated (significantly) for Visual Studio 2008 -- which is
to say within the last few months (note how I've used the exclamation
point to emphasize something that clearly is NOT known to many
developers).
Jerry needs no support from me but just to bolster his point, please
read the Visual C++ team blog's latest entry:
http://blogs.msdn.com/vcblog/archive...the-booth.aspx

The recent updates to MFC apparently was the talk of TechEd 2008.
Right -- I should also mention that although it's clearly the _largest_
update to MFC in quite a while, this really is NOT the first in ten
years as was stated elsethread. Documentation of them has been minimal
(to put it nicely) but I believe every release of the compiler has
included at least a few minor updates to MFC.
Also, I don't know if Jerry knows about this but John Torjo's template
based C++-GUI library is also shaping up to be a fine competitor:
http://msdn.microsoft.com/en-us/magazine/cc534994.aspx
Yup -- while this clearly has a lot less support, it also looks like
quite a decent library.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 7 '08 #17

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

Similar topics

6
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with...
2
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing...
7
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using...
11
by: olle | last post by:
Hi everyone. I am an Access developer having worked with Access-dev. projects for many years on Sql server databases and Access. For the internet I have been using traditional asp. But now I have...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
6
by: VR | last post by:
Hi, I read about Master Pages in ASP.Net 2.0 and after implementing some WinForms Visual Inheritance I tryed it with WebForms (let's say .aspx pages, my MasterPage does not have a form tag itself...
3
by: Shapper | last post by:
Hello, I am starting 2 new projects to deliver in January 2006. I want to create them in Asp.Net 2.0 using Visual Studio 2005. All my clients web sites are Visual Studio 2003 projects in...
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
1
by: DR | last post by:
What ports do i need to unblock on client and server (running msvsmon.exe) to debug remotely from my client box with visual studio 2005 pro? When I attach to remote process a connection shows up...
0
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.