Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

fixing or working around a problem with MFC42d.dll

Posted on 2004-08-10
5
Medium Priority
?
15,327 Views
Last Modified: 2013-11-20
Hello, I am trying to compile a WRAPI test program and am having MFC difficulties.

Background:  I am working in C++ .NET 2003 and the program instructions assume Studio 6.0.  Reading threads with other people having earlier compile difficulties over in the Wireless question area, I added the next two lines to stdafx.h

#include <afx.h>
#include <afxwin.h>

Without those, the next, essential line, explodes messily in bad syntax.

#include <ntddndis.h>

Those includes mean the test program, otherwise a console app, needs the appropriate dll.

When I build the program it compiles completely.  On running it tells me "the application has failed to start because MFC42D.DLL was not found.  Re-installing the applicaiton may fix the problem."

No biggie.  I copied MFC42D.dll to my source directory, rebuilt, and got:  "The application or DLL c:\<source>\MFC42D.DLL is not a valid Windows image.  Please check this against your installation diskette."

I don't know enough about MFC to do more then flail at a solution.  I'd appreciate advice on any of the following:

1)  An explanation of the above and how to fix it.

2)  A work around.  Then test program is a console app.  Does ntddndis.h needs MFC (I don't know)?  If not, how can I replace the afx.h & afxwin.h with anything?

3)  I've looked for MFC42D.DLL on my .NET install disks and on Microsoft support.  Where can I find a valid Windows image?

4)  Another way to solve this problem.

Thanks,

Rylen
0
Comment
Question by:rylen
[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
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 11770857
Do you want to use MFC in your project?
Or would a line like
#include <windows.h>
be sufficient. It might be necessary to do some definitions before that line.
0
 
LVL 1

Author Comment

by:rylen
ID: 11775496
Thanks SteH.  This may be a start but unfortunately does not solve the problem yet.  This is currently an MFC because a bit of previous solution I followed led me to insert afx.h and afxwin.h.

I dropped afx.h and afxwin.h for windows.h and have tried to build with "Use of MFC" set to both "Standard Windows Library" and "MFC in static library."  In both cases my results depended on if I'd removed MFC42D.dll and .lib from the source directory.  If I remove them, I get:  "The application has failed to start ..." as above.  If I put them back, I get "The application or DLL .. is not a vaild Windows image ..." as above.
0
 
LVL 13

Accepted Solution

by:
SteH earned 800 total points
ID: 11781157
If you have a console app that uses MFC you need to include afx.h and afxwin.h! Only in a purist approach you would use Win APIs for a console app if you use windows at all. If I use the app wizard to create a console app that support MFC I get the following includes in stdafx.h:

#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers

#include <afx.h>
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdtctl.h>            // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>                  // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <iostream>  ///< This is support for console operations.

Another thing might be some defines which are not uptodate any more:
See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcconmfcvisualcversionnumbers.asp
for versions of MFC shipped with different versions of VC++ and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/versions.asp
for common controls.

From those sources you should use (automatically?) mfc71.dll and not mfc42.dll (the extra d after the number is only for debug version of those DLLs).

0
 
LVL 13

Expert Comment

by:SteH
ID: 11781165
0
 
LVL 1

Author Comment

by:rylen
ID: 11802554
Thanks.  From this I've gotten a extremly important bit of information.  VC++ 7 is not compatible w/ DLLs from VC++ 6.  I'll be using the links you gave me (and reading and asking questions) to recompile the WRAPI source code to work in .NET.

Rylen
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 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