在调试程序时发现在这一句执行后:
 hwnd = CreateWindow (szAppName, szCaption,
                          WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInstance, NULL) ;
Unhandled exception in Poepoem.exe :0xC0000005 :Access Violation
消息框,然后退出。不知是什么原因.请各位指教!

解决方案 »

  1.   

    WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,是不是有些属性不能同时用?
    你只用前一个试试
      

  2.   

    to  jemmylau(枕头) :
     那倒不是,从光盘上的源程序是可以的,这是 windows程序设计的例子 ,我也不知道我按它的样子打上去就不行了
      

  3.   

    估计是szAppName, szCaption,有误.
      

  4.   

    HWND CreateWindow(
      LPCTSTR lpClassName,  // registered class name ????
      LPCTSTR lpWindowName, // window name
      DWORD dwStyle,        // window style
      int x,                // horizontal position of window
      int y,                // vertical position of window
      int nWidth,           // window width
      int nHeight,          // window height
      HWND hWndParent,      // handle to parent or owner window
      HMENU hMenu,          // menu handle or child identifier
      HINSTANCE hInstance,  // handle to application instance
      LPVOID lpParam        // window-creation data
    );
      

  5.   

    按字面上说应该没有错。但是不知道你定义的szAppName, szCaption都赋什么直了!