Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Problems with VS6 -> VS13 migration

$
0
0

Thanks for the responses to my earlier query. I'm still stuck getting a custom handler added to a basic hello world problem.Here's my code, the shell is  a basic Hello World program off the web that reflects very closely the basic structure of the old programs that I'm trying to reestablish.

As an aside, one thing that's confusing me is "Unable to recover from previous errors". Does this mean that there are errors earlier in the code that are not being reported? What *does* it mean??

If I can get the message map thing sorted I should be OK.   T (a lot)IA

Statements with // ###### after them are the additions to the shell. The only additions are a null custom handler, with a declaration in the message map.

The errors I'm getting is after the code.

// helloapp.cpp : Minimal MFC Windows app.
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include <afxwin.h>
#define DRAWFIX   (WM_USER + 1)    //######

CDC        my_memDC;
CBitmap  my_bitmap;


class CMainWindow : public CWnd
{
public:
    CMainWindow();

    afx_msg void OnPaint();
    afx_msg void Background(WPARAM wp, LPARAM lp); // ###### 
    DECLARE_MESSAGE_MAP()
};



LPCTSTR txtbuf;
int mx, my;
HWND hWnd;

// Define a window class derived from CFrameWnd
class CHelloWindow : public CFrameWnd
{
public:
    CHelloWindow()
    {
        Create(NULL, _T("Test program"), WS_OVERLAPPEDWINDOW, rectDefault);
        CClientDC dc(this);
        mx = GetSystemMetrics(SM_CXSCREEN);
        my = GetSystemMetrics(SM_CYSCREEN);
        my_bitmap.CreateCompatibleBitmap(&dc, mx, my);
        my_memDC.CreateCompatibleDC(&dc);
    }
};


// Define an application class derived from CWinApp
class CHelloApp : public CWinApp
{
public:
    virtual BOOL InitInstance()
        {
        m_pMainWnd = new CHelloWindow()  ;
        m_pMainWnd->ShowWindow(m_nCmdShow)  ;
        m_pMainWnd->UpdateWindow()  ;

        return TRUE;
    }
};


BEGIN_MESSAGE_MAP(CMainWindow, CWnd)
    ON_WM_PAINT()
    ON_MESSAGE(DRAWFIX, Background) // ###### <<= ========= All errors reference this line
END_MESSAGE_MAP()


CHelloApp HelloApp;  // HelloApp's constructor initializes and runs the app


afx_msg void CMainWindow::OnPaint()
{
    CPaintDC dc(this);
    dc.BitBlt(0, 0, mx, my, &my_memDC, 0, 0, SRCCOPY);
    return;
}


afx_msg void CMainWindow::Background(WPARAM wp, LPARAM lp) // ######
{ // ######
} // ######

HERE ARE THE ERRORS

Error    2    error C1903: unable to recover from previous error(s); stopping compilation    C:\...\Projects\helloapp\helloapp.cpp    71    1    Helloapp

Error    1    error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainWindow::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'    C:\...\helloapp.cpp    71   1    Helloapp

    3    IntelliSense: invalid type conversion    c:\....\helloapp\helloapp.cpp    71    2    Helloapp


bv


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>