EirikO
June 29th, 2007, 02:16 AM
I have the following code:
BEGIN_MESSAGE_MAP(CTCPClientAppDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
ON_WM_SIZE()
#endif
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON1, &CTCPClientAppDlg::OnBnClickedButton1)
ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect)
ON_MESSAGE(WM_MYSOCKET_ONRECEIVE, OnMySocketReceive)
END_MESSAGE_MAP()
When I try to build the Solution, I get:
1>------ Build started: Project: TCPClientApp, Configuration: Debug Windows Mobile 5.0 Pocket PC SDK (ARMV4I) ------
1>Compiling...
1>TCPClientAppDlg.cpp
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing '}' before ';'
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing '}' before ';'
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing ';' before ','
1>.\TCPClientAppDlg.cpp(33) : error C2059: syntax error : ','
1>.\TCPClientAppDlg.cpp(34) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(34) : error C2447: '{' : missing function header (old-style formal list?)
1>.\TCPClientAppDlg.cpp(34) : error C2059: syntax error : ','
1>.\TCPClientAppDlg.cpp(35) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(35) : error C2447: '{' : missing function header (old-style formal list?)
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : '}'
1>.\TCPClientAppDlg.cpp(35) : error C2653: 'TheBaseClass' : is not a class or namespace name
1>.\TCPClientAppDlg.cpp(35) : error C2065: 'GetThisMessageMap' : undeclared identifier
1>.\TCPClientAppDlg.cpp(35) : error C2065: '_messageEntries' : undeclared identifier
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : 'return'
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : '}'
1>.\TCPClientAppDlg.cpp(41) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(41) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://c:\MyDocs\Visual Studio 2005\Projects\TCPClientApp\TCPClientApp\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug\BuildLog.htm"
1>TCPClientApp - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
100000$ question: Why?
Some additional info:
ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect) is line 33.
In MySocket.h I have:
#define WM_MYSOCKET_ONACCEPT (WM_USER + 1);
//afx_msg LRESULT OnMySocketAccept(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONACCEPT, OnMySocketAccept);
#define WM_MYSOCKET_ONCONNECT (WM_USER + 2);
//afx_msg LRESULT OnMySocketConnect(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect);
#define WM_MYSOCKET_ONRECEIVE (WM_USER + 3);
//afx_msg LRESULT OnMySocketReceive(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONRECEIVE, OnMySocketReceive);
#define WM_MYSOCKET_ONCLOSE (WM_USER + 4);
//afx_msg LRESULT OnMySocketClose(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONCLOSE, OnMySocketClose);
And in TCPClientAppDlg.h:
protected:
afx_msg LRESULT OnMySocketConnect(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMySocketReceive(WPARAM wParam, LPARAM lParam);
TCPClientAppDlg.cpp:
LRESULT CTCPClientAppDlg::OnMySocketReceive(WPARAM wParam, LPARAM lParam)
{
BYTE Data[256] = {0};
int BytesRecieved = m_MySocket.Receive(Data, sizeof(Data));
if(BytesRecieved > 0)
{
m_OutputCtrl.AddString(_T("Received:"));
[.....]
BEGIN_MESSAGE_MAP(CTCPClientAppDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
ON_WM_SIZE()
#endif
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON1, &CTCPClientAppDlg::OnBnClickedButton1)
ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect)
ON_MESSAGE(WM_MYSOCKET_ONRECEIVE, OnMySocketReceive)
END_MESSAGE_MAP()
When I try to build the Solution, I get:
1>------ Build started: Project: TCPClientApp, Configuration: Debug Windows Mobile 5.0 Pocket PC SDK (ARMV4I) ------
1>Compiling...
1>TCPClientAppDlg.cpp
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing '}' before ';'
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing '}' before ';'
1>.\TCPClientAppDlg.cpp(33) : error C2143: syntax error : missing ';' before ','
1>.\TCPClientAppDlg.cpp(33) : error C2059: syntax error : ','
1>.\TCPClientAppDlg.cpp(34) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(34) : error C2447: '{' : missing function header (old-style formal list?)
1>.\TCPClientAppDlg.cpp(34) : error C2059: syntax error : ','
1>.\TCPClientAppDlg.cpp(35) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(35) : error C2447: '{' : missing function header (old-style formal list?)
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : '}'
1>.\TCPClientAppDlg.cpp(35) : error C2653: 'TheBaseClass' : is not a class or namespace name
1>.\TCPClientAppDlg.cpp(35) : error C2065: 'GetThisMessageMap' : undeclared identifier
1>.\TCPClientAppDlg.cpp(35) : error C2065: '_messageEntries' : undeclared identifier
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : 'return'
1>.\TCPClientAppDlg.cpp(35) : error C2059: syntax error : '}'
1>.\TCPClientAppDlg.cpp(41) : error C2143: syntax error : missing ';' before '{'
1>.\TCPClientAppDlg.cpp(41) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://c:\MyDocs\Visual Studio 2005\Projects\TCPClientApp\TCPClientApp\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug\BuildLog.htm"
1>TCPClientApp - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
100000$ question: Why?
Some additional info:
ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect) is line 33.
In MySocket.h I have:
#define WM_MYSOCKET_ONACCEPT (WM_USER + 1);
//afx_msg LRESULT OnMySocketAccept(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONACCEPT, OnMySocketAccept);
#define WM_MYSOCKET_ONCONNECT (WM_USER + 2);
//afx_msg LRESULT OnMySocketConnect(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONCONNECT, OnMySocketConnect);
#define WM_MYSOCKET_ONRECEIVE (WM_USER + 3);
//afx_msg LRESULT OnMySocketReceive(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONRECEIVE, OnMySocketReceive);
#define WM_MYSOCKET_ONCLOSE (WM_USER + 4);
//afx_msg LRESULT OnMySocketClose(WPARAM wParam, LPARAM lParam);
//ON_MESSAGE(WM_MYSOCKET_ONCLOSE, OnMySocketClose);
And in TCPClientAppDlg.h:
protected:
afx_msg LRESULT OnMySocketConnect(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnMySocketReceive(WPARAM wParam, LPARAM lParam);
TCPClientAppDlg.cpp:
LRESULT CTCPClientAppDlg::OnMySocketReceive(WPARAM wParam, LPARAM lParam)
{
BYTE Data[256] = {0};
int BytesRecieved = m_MySocket.Receive(Data, sizeof(Data));
if(BytesRecieved > 0)
{
m_OutputCtrl.AddString(_T("Received:"));
[.....]