dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Strange behaviour of message handlers 2

  1. #1
    Join Date
    Aug 2009
    Posts
    23

    Question Strange behaviour of message handlers 2

    dears

    about the post 1: STRANGE BEHAVIOUR OF MESSAGE HANDLERS, there is more


    The error shown in the previous post is due to the fact that in the past i added some ocx from vc++ container ... then i deleted them ....

    however in my code there are these lines:

    BEGIN_EVENTSINK_MAP(CMyClassDlg, CDialog)
    END_EVENTSINK_MAP


    If i delete them the compiler gives this error:



    error LNK2001: unresolved external symbol "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall CNC3D_vs2Dlg::GetEventSinkMap(void)const " (?GetEventSinkMap@CNC3D_vs2Dlg@@MBEPBUAFX_EVENTSINKMAP@@XZ)
    Release/CMyClassDlg.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.


    Please, do you know how can i resolve this problem ?


    regards

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,624

    Re: Strange behaviour of message handlers 2

    1. Never start a new thread with exactly the same problem as in your previous one. You should rather go on posting in your initial thread!

    2. It is not a good idea - to remove by hand something that you added with some type of Wizard.

    3. Try to remove DECLARE_EVENTSINK_MAP macro from your class declaration
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2009
    Posts
    23

    Question Re: Strange behaviour of message handlers 2

    thanks ... the right replay is the 3 you send me ..



    please, a question ...

    i have written the following function; CWnd * hWnd = AfxGetMainWnd() allows me to give the input focus to the the main window after click on the slider ....

    CODE______________________________________________

    void CNC3D_vs2Dlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
    // TODO: Add your message handler code here and/or call default

    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);

    CWnd * hWnd = AfxGetMainWnd();

    }
    _______________________________________________________


    have you idea because it cannot work ?

    I have the same code in another program and there it works ...

    Maybe can it be related with the wrong cancellation of the eventsink messages ? what this change inside the program ?


    thanks very much

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,624

    Re: Strange behavior of message handlers 2

    Quote Originally Posted by vikvik66 View Post
    thanks ... the right replay is the 3 you send me ..
    "replay" or reply?

    Quote Originally Posted by vikvik66 View Post
    i have written the following function; CWnd * hWnd = AfxGetMainWnd() allows me to give the input focus to the the main window after click on the slider ....

    CODE______________________________________________

    void CNC3D_vs2Dlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
    // TODO: Add your message handler code here and/or call default

    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);

    CWnd * hWnd = AfxGetMainWnd();

    }
    _______________________________________________________


    have you idea because it cannot work ?
    1. Please, always use Code tags while posting code snippets.

    2. The code snippet you posted gave me no idea because there is no any useful information.
    Victor Nijegorodov

  5. #5
    Join Date
    Aug 2009
    Posts
    23

    Arrow Re: Strange behaviour of message handlers 2

    reply is the correct one ... my error ! excuse me. i'll try to use tags ... i'm new of this forum ...

    You said a right thing about the code ...

    what i want is control the slider control so that after change its value with the click of the mouse, the input focus can return to the main window .... generally this is no true ... the slider remain linked to the mouse wheel .... cslider is a diabolic control !!!

    for this reason i try to give the input focus to the main window with the AfxGetMainWnd() ....

    i have done a mistake ... excuse me .. the correct one is:

    in InitDialog I define CWnd * hWnd = AfxGetMainWnd() so to take a pointer to the main window, then:


    void CNC3D_vs2Dlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
    // TODO: Add your message handler code here and/or call default

    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
    hWnd->SetFocus();

    }


    thanks in advance !

    best regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)