T
tonyjeffs
This code to create an empty window is from a web tutorial that goes
into interesting detail on message maps.
It is written for msvc6.
I have a stupid way to make it work in 2005; install a different
outdated program and let msvc update it, then substitute the code from
this exercise.
But what is the proper way to make it work?
/*Error: fatal error C1189: #error : Building MFC application with /
MD[d] (CRT dll version) requires MFC shared dll version. Please
#define _AFXDLL or do not use /MD[d]
....What does this mean and why is it not an issue in the version that
works... (same code)?*/
thanks
Tony
//MFC2.CPP - MFC Tutorial Part 2 from CoderSource.net
#include <afxwin.h>
class MFC_Tutorial_Window ublic CFrameWnd
{
public:
MFC_Tutorial_Window()
{
Create(NULL,"MFC Tutorial Part 2 CoderSource Window");
}
void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP( MFC_Tutorial_Window, CFrameWnd)
ON_WM_LBUTTONDOWN() //Macro to map the left button click to the
handler
END_MESSAGE_MAP()
void MFC_Tutorial_Window::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CFrameWnd::OnLButtonDown(nFlags, point);
MessageBox("Left Button clicked");
}
class MyApp ublic CWinApp
{
MFC_Tutorial_Window *wnd;
public:
BOOL InitInstance()
{
wnd = new MFC_Tutorial_Window();
m_pMainWnd = wnd;
m_pMainWnd->ShowWindow(1);
return 1;
}
};
MyApp theApp;
Thanks
Tony
into interesting detail on message maps.
It is written for msvc6.
I have a stupid way to make it work in 2005; install a different
outdated program and let msvc update it, then substitute the code from
this exercise.
But what is the proper way to make it work?
/*Error: fatal error C1189: #error : Building MFC application with /
MD[d] (CRT dll version) requires MFC shared dll version. Please
#define _AFXDLL or do not use /MD[d]
....What does this mean and why is it not an issue in the version that
works... (same code)?*/
thanks
Tony
//MFC2.CPP - MFC Tutorial Part 2 from CoderSource.net
#include <afxwin.h>
class MFC_Tutorial_Window ublic CFrameWnd
{
public:
MFC_Tutorial_Window()
{
Create(NULL,"MFC Tutorial Part 2 CoderSource Window");
}
void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP( MFC_Tutorial_Window, CFrameWnd)
ON_WM_LBUTTONDOWN() //Macro to map the left button click to the
handler
END_MESSAGE_MAP()
void MFC_Tutorial_Window::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CFrameWnd::OnLButtonDown(nFlags, point);
MessageBox("Left Button clicked");
}
class MyApp ublic CWinApp
{
MFC_Tutorial_Window *wnd;
public:
BOOL InitInstance()
{
wnd = new MFC_Tutorial_Window();
m_pMainWnd = wnd;
m_pMainWnd->ShowWindow(1);
return 1;
}
};
MyApp theApp;
Thanks
Tony