?
Solved

How to replace WinMain() of MFC with my own...

Posted on 1997-01-21
1
Medium Priority
?
477 Views
Last Modified: 2013-11-20
As we know, WinMain() function in MFC application is prepared by MFC itself and linked into the code automatically.  This implies, that even we only want to use DAO/WinSock object, a CWinApp class instance is required.  Such constraint is very inconvenient for us because we don't want to use the whole MFC framework (we just want to make use of DAO...).

I think it's common problem for MFC programmers.  Thus, could anyone give me your experience about "HOW TO REPLACE MFC'S WinMain() WITH YOUR OWN ONE"?
0
Comment
Question by:chcheng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
jmp012097 earned 100 total points
ID: 1300574
I'm afraid that even if you replace WinMain, you would still have to play the game of MFC and use a CWinApp class.

CWinApp implements the message loop. You would have to do it yourself (including idle time handling to update your user interface). I'm pretty sure most other features will assert if they can't find an application object.

My advice is to stick with the App class, but do not create document and view objects. If you statically link your application, you should get a light .EXE (if you can assume that your customers all have the DLL version of MFC, this is even better of course).

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question