解决方案 »

  1.   

    看看这个:
    http://blog.csdn.net/yuvmen/article/details/5877271
      

  2.   

    如果纯粹从使用的角度来讲,不用理会CMyApp这个类(不要动它),对于对话窗程序:从CXXXDlg::OnInitialDlg()函数入口;对于单文档程序:从CXXXView::OnInitialUpdate()函数入口。
      

  3.   


    //代码能运行
    #include <windows.h>
    #include <stdio.h>LRESULT CALLBACK WinSunProc(
    HWND hwnd,      // handle to window
    UINT uMsg,      // message identifier
    WPARAM wParam,  // first message parameter
    LPARAM lParam   // second message parameter
    );int WINAPI WinMain(//入口函数........
       HINSTANCE hInstance,      // handle to current instance
       HINSTANCE hPrevInstance,  // handle to previous instance
       LPSTR lpCmdLine,          // command line
       int nCmdShow              // show state
       )
    {
    WNDCLASS wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbWndExtra=0;
    wndcls.hbrBackground=(HBRUSH)GetStockObject(GRAY_BRUSH);
    wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
    wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wndcls.hInstance=hInstance;
    wndcls.lpfnWndProc=WinSunProc;
    wndcls.lpszClassName="Weixin2003";
    wndcls.lpszMenuName=NULL;
    wndcls.style=CS_HREDRAW ;
    RegisterClass(&wndcls);

    HWND hwnd;
    hwnd=CreateWindow("Weixin2003","北京维新科学技术培训中\
    心",WS_OVERLAPPEDWINDOW &~WS_MAXIMIZEBOX   ,
    0,0,600,400,NULL,NULL,hInstance,NULL);

    ShowWindow(hwnd,SW_SHOWNORMAL);
    //UpdateWindow(hwnd);//可有可无

    MSG msg;
    while(GetMessage(&msg,NULL,0,0))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    return 0;
    }LRESULT CALLBACK WinSunProc(
    HWND hwnd,      // handle to window
    UINT uMsg,      // message identifier
    WPARAM wParam,  // first message parameter
    LPARAM lParam   // second message parameter
    )
    {
    switch(uMsg)
    {
    case WM_CHAR:
    char szChar[20];
    sprintf(szChar,"char is %d",wParam);
    MessageBox(hwnd,szChar,"weixin",0);
    break;
    case WM_LBUTTONDOWN:
    MessageBox(hwnd,"mouse clicked","weixin",0);
    HDC hdc;
    hdc=GetDC(hwnd);
    TextOut(hdc,0,50,"计算机编程语言培训",strlen("计算机编程语言培训"));
    ReleaseDC(hwnd,hdc);
    break;
    case WM_PAINT:
    HDC hDC;
    PAINTSTRUCT ps;
    hDC=BeginPaint(hwnd,&ps);
    TextOut(hDC,0,0,"维新培训",strlen("维新培训"));
    EndPaint(hwnd,&ps);
    break;
    case WM_CLOSE:
    if(IDYES==MessageBox(hwnd,"是否真的结束?","weixin",MB_YESNO))
    {
    DestroyWindow(hwnd);
    }
    break;
    case WM_DESTROY:
    PostQuitMessage(0);
    break;
    default:
    return DefWindowProc(hwnd,uMsg,wParam,lParam);
    }
    return 0;
    }
      

  4.   

    MFC是WinMain,是一个循环,在不断接收消息,然后分派消息到各个窗口类。
    所以从main开始的写软件思路是错误的。你可以写代码的地方很多,如create消息,initdialog消息等,都可以,不同需求 写的地方不同
      

  5.   

    还不是WinMain/wWinMain,不设置任何断点,按F10就看到了
      

  6.   

    CWinApp是入口,你可以先学习下Win32,然后回过头来看这段代码
      

  7.   

    MFC封装起来了, 表面上你看不到
      

  8.   

    深入迁出mfc里 老侯专门为这个入口写了一个简单的“mfc”