Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Message Map Problem [modified]

Message Map Problem [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++csharpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minihotto
    wrote on last edited by
    #1

    Hello, I create a "Windows Form Application" project that names p2pport, in Microsoft visual .NET 2005. I want to use the Message Map. I see it on MSDN. MFC uses it. So I include the #include , and use MFC in a shared DLL. This is my code. BEGIN_MESSAGE_MAP(p2pport::Dlg,public System::Windows::Forms::Form) ON_MESSAGE(WM_UI1, p2pport::Dlg::OnUI1, WPARAM wParam, LPARAM lParam) ON_MESSAGE(WM_UI2, p2pport::Dlg::OnUI2, WPARAM wParam, LPARAM lParam) ON_MESSAGE(MM_MIXM_LINE_CHANGE,p2pport::Dlg::onMixerCallBack) ON_MESSAGE(MM_MIXM_CONTROL_CHANGE,p2pport::Dlg::onMixerCallBack) END_MESSAGE_MAP() p2pport is my project name, and Dlg is the name of my form file. But I get a lots of errors. error C2039: 'GetMessageMap' : is not a member of 'p2pport::Dlg' error C2039: 'GetThisMessageMap' : is not a member of 'p2pport::Dlg' error C2039: 'GetThisMessageMap' : is not a member of 'System::Int32' error C2270: 'GetMessageMap' : modifiers not allowed on nonmember functions error C2365: 'GetThisMessageMap' : redefinition; previous definition was 'formerly unknown identifier' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C3861: 'GetThisMessageMap': identifier not found error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I google it, but nothing finds. Can anybody help me to solve it? Appreciate for ur reply. Thx. -- modified at 5:03 Tuesday 6th November, 2007

    B 1 Reply Last reply
    0
    • M minihotto

      Hello, I create a "Windows Form Application" project that names p2pport, in Microsoft visual .NET 2005. I want to use the Message Map. I see it on MSDN. MFC uses it. So I include the #include , and use MFC in a shared DLL. This is my code. BEGIN_MESSAGE_MAP(p2pport::Dlg,public System::Windows::Forms::Form) ON_MESSAGE(WM_UI1, p2pport::Dlg::OnUI1, WPARAM wParam, LPARAM lParam) ON_MESSAGE(WM_UI2, p2pport::Dlg::OnUI2, WPARAM wParam, LPARAM lParam) ON_MESSAGE(MM_MIXM_LINE_CHANGE,p2pport::Dlg::onMixerCallBack) ON_MESSAGE(MM_MIXM_CONTROL_CHANGE,p2pport::Dlg::onMixerCallBack) END_MESSAGE_MAP() p2pport is my project name, and Dlg is the name of my form file. But I get a lots of errors. error C2039: 'GetMessageMap' : is not a member of 'p2pport::Dlg' error C2039: 'GetThisMessageMap' : is not a member of 'p2pport::Dlg' error C2039: 'GetThisMessageMap' : is not a member of 'System::Int32' error C2270: 'GetMessageMap' : modifiers not allowed on nonmember functions error C2365: 'GetThisMessageMap' : redefinition; previous definition was 'formerly unknown identifier' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C2440: 'static_cast' : cannot convert from 'void (__clrcall p2pport::Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' error C3861: 'GetThisMessageMap': identifier not found error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I google it, but nothing finds. Can anybody help me to solve it? Appreciate for ur reply. Thx. -- modified at 5:03 Tuesday 6th November, 2007

      B Offline
      B Offline
      baerten
      wrote on last edited by
      #2

      Own created messages will be handled this way in >>MFC<<: In header: class MyView { ... LRESULT OnMyMessage(WPARAM w=0,LPARAM l=0); ... }; in .cpp: BEGIN_MESSAGEMAP(MyView,CFormView) ON_MESSAGE(WM_MY_OWN_MESSAGE,OnMyMessage) END_MESSAGE_MAP() LRESULT MyView::OnMyMessage(WPARAM w,LPARAM l) { // Work return TRUE; } I hope this helps you :)

      M 1 Reply Last reply
      0
      • B baerten

        Own created messages will be handled this way in >>MFC<<: In header: class MyView { ... LRESULT OnMyMessage(WPARAM w=0,LPARAM l=0); ... }; in .cpp: BEGIN_MESSAGEMAP(MyView,CFormView) ON_MESSAGE(WM_MY_OWN_MESSAGE,OnMyMessage) END_MESSAGE_MAP() LRESULT MyView::OnMyMessage(WPARAM w,LPARAM l) { // Work return TRUE; } I hope this helps you :)

        M Offline
        M Offline
        minihotto
        wrote on last edited by
        #3

        Thx for your reply. It helps me a lot. But I still get some errors. I create a header file that named CMyView and the content is following. #ifndef CMYVIEW_H #define CMYVIEW_H #include <afxwin.h> #include <afxext.h> public class CMyView : public CFormView { LRESULT OnUI1(WPARAM wParam, LPARAM lParam); LRESULT OnUI2(WPARAM wParam, LPARAM lParam); LRESULT onMixerCallBack(WPARAM wParam, LPARAM lParam); }; #endif And my code is modified as below. BEGIN_MESSAGE_MAP(CMyView,CFormView) ON_MESSAGE(WM_UI1, OnUI1) ON_MESSAGE(WM_UI2, OnUI2) ON_MESSAGE(MM_MIXM_LINE_CHANGE,onMixerCallBack) ON_MESSAGE(MM_MIXM_CONTROL_CHANGE,onMixerCallBack) END_MESSAGE_MAP() And there's the error. error C2509: 'GetMessageMap' : member function not declared in 'CMyView' error C2509: 'GetThisMessageMap' : member function not declared in 'CMyView' How could I solve this problem? Appreciate for ur reply. Thx.

        M 1 Reply Last reply
        0
        • M minihotto

          Thx for your reply. It helps me a lot. But I still get some errors. I create a header file that named CMyView and the content is following. #ifndef CMYVIEW_H #define CMYVIEW_H #include <afxwin.h> #include <afxext.h> public class CMyView : public CFormView { LRESULT OnUI1(WPARAM wParam, LPARAM lParam); LRESULT OnUI2(WPARAM wParam, LPARAM lParam); LRESULT onMixerCallBack(WPARAM wParam, LPARAM lParam); }; #endif And my code is modified as below. BEGIN_MESSAGE_MAP(CMyView,CFormView) ON_MESSAGE(WM_UI1, OnUI1) ON_MESSAGE(WM_UI2, OnUI2) ON_MESSAGE(MM_MIXM_LINE_CHANGE,onMixerCallBack) ON_MESSAGE(MM_MIXM_CONTROL_CHANGE,onMixerCallBack) END_MESSAGE_MAP() And there's the error. error C2509: 'GetMessageMap' : member function not declared in 'CMyView' error C2509: 'GetThisMessageMap' : member function not declared in 'CMyView' How could I solve this problem? Appreciate for ur reply. Thx.

          M Offline
          M Offline
          minihotto
          wrote on last edited by
          #4

          I got it. I lose DECLARE_MESSAGE_MAP()in the header file. The correct code is as below. #ifndef CMYVIEW_H #define CMYVIEW_H #include <afxwin.h> #include <afxext.h> public class CMyView : public CFormView { public: afx_msg LRESULT OnUI1(WPARAM wParam, LPARAM lParam); LRESULT OnUI2(WPARAM wParam, LPARAM lParam); LRESULT onMixerCallBack(WPARAM wParam, LPARAM lParam); protected: DECLARE_MESSAGE_MAP(); }; #endif

          B 1 Reply Last reply
          0
          • M minihotto

            I got it. I lose DECLARE_MESSAGE_MAP()in the header file. The correct code is as below. #ifndef CMYVIEW_H #define CMYVIEW_H #include <afxwin.h> #include <afxext.h> public class CMyView : public CFormView { public: afx_msg LRESULT OnUI1(WPARAM wParam, LPARAM lParam); LRESULT OnUI2(WPARAM wParam, LPARAM lParam); LRESULT onMixerCallBack(WPARAM wParam, LPARAM lParam); protected: DECLARE_MESSAGE_MAP(); }; #endif

            B Offline
            B Offline
            baerten
            wrote on last edited by
            #5

            Outstanding :) Great that it works for you :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups