locked
using mfc in .net2003 RRS feed

  • Question

  • hi all,

    i am new to MFC programming. rite now i have started reading mfc programming book by jeff prosise. I have .net2003 with me. Now i am starting my application with following steps

    1. select win32 application from the project selection option

    2. in application setting i check mark empty project tag

    3. i change the project setting to "use mfc in shared dll "

    Now i copied the source code to .h and .cpp file and excuted  it. but it is giving me the following errors

     

    c:\Documents and Settings\kunal\My Documents\Visual Studio Projects\mfc examples\s1234\s1.cpp(39): error C3209: ' DT_CENTER' : Unicode identifiers are not yet supported

    c:\Documents and Settings\kunal\My Documents\Visual Studio Projects\mfc examples\s1234\s1.cpp(39): error C3209: ' DT_VCENTER' : Unicode identifiers are not yet supported

    c:\Documents and Settings\kunal\My Documents\Visual Studio Projects\mfc examples\s1234\s1.cpp(39): error C2146: syntax error : missing ')' before identifier ' DT_CENTER'

    c:\Documents and Settings\kunal\My Documents\Visual Studio Projects\mfc examples\s1234\s1.cpp(39): error C2059: syntax error : ')'

     

    i am not able to interpret the errors. please help me out of it. I guess i m not starting the application properly because code is correct(i just copy pasted from book)

     

    Thanks

    kunal s pate

     

    Monday, April 17, 2006 4:40 AM

Answers

  • Mabe your | character is wrong.

    DT_SINGLELINE ¦ DT_CENTER ¦ DT_VCENTER

    seams to be different from the one I use, even in the same font:

    DT_SINGLELINE | DT_CENTER | DT_VCENTER

    Monday, April 17, 2006 7:28 AM

All replies

  • i m sorry i didnt post the code for reference. here is the code for reference

    Hello.h file

    class CMyApp : public CWinApp

    {

    public:

    virtual BOOL InitInstance ();

    };

    class CMainWindow : public CFrameWnd

    {

    public:

    CMainWindow ();

    protected:

    afx_msg void OnPaint ();

    DECLARE_MESSAGE_MAP ()

    };

     

     

    hello.cpp file

    #include <afxwin.h>

    #include "Hello.h"

    CMyApp myApp;

    /////////////////////////////////////////////////////////////////////////

    // CMyApp member functions

    BOOL CMyApp::InitInstance ()

    {

    m_pMainWnd = new CMainWindow;

    m_pMainWnd->ShowWindow (m_nCmdShow);

    m_pMainWnd->UpdateWindow ();

    return TRUE;

    }

    /////////////////////////////////////////////////////////////////////////

    // CMainWindow message map and member functions

    BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)

    ON_WM_PAINT ()

    END_MESSAGE_MAP ()

    CMainWindow::CMainWindow ()

    {

    Create (NULL, _T ("The Hello Application"));

    }

    void CMainWindow::OnPaint ()

    {

    CPaintDC dc (this);

    CRect rect;

    GetClientRect (&rect);

    dc.DrawText (_T ("Hello, MFC"), -1, &rect,

    DT_SINGLELINE ¦ DT_CENTER ¦ DT_VCENTER);

    }

    Monday, April 17, 2006 4:50 AM
  • Mabe your | character is wrong.

    DT_SINGLELINE ¦ DT_CENTER ¦ DT_VCENTER

    seams to be different from the one I use, even in the same font:

    DT_SINGLELINE | DT_CENTER | DT_VCENTER

    Monday, April 17, 2006 7:28 AM