#include<windows.h>
#include<stdio.h>
int WINAPI WinMain(
  HINSTANCE hInstance,  // handle to current instance
  HINSTANCE hPrevInstance,  // handle to previous instance
  LPSTR lpCmdLine,      // pointer to command line
  int nCmdShow          // show state of window
)
{
LRESULT CALLBACK myProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);
WNDCLASS wlass;
wlass.cbClsExtra=0;
wlass.cbWndExtra=0;
wlass.hbrBackground=(HBRUSH)GetStockObject(GRAY_BRUSH);
wlass.hCursor=LoadCursor(NULL,IDC_CROSS);
wlass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wlass.hInstance=hInstance;
wlass.lpfnWndProc=myProc;
wlass.lpszClassName="my";
wlass.lpszMenuName=NULL;
wlass.style=CS_VREDRAW|CS_HREDRAW;
RegisterClass(&wlass);
HWND Hwnd;
Hwnd=CreateWindow("my","毛毛雨系列软件",WS_OVERLAPPEDWINDOW,0,0,400,500,NULL,NULL,hInstance,NULL);
ShowWindow(Hwnd,SW_SHOWMAXIMIZED);
UpdateWindow(Hwnd);MSG msg;
while(GetMessage(&msg,0,NULL,NULL))
{
TranslateMessage(&msg);
DispatchMessage(&msg);};
 
return 0;}
LRESULT CALLBACK myProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
)
{
  switch(uMsg)
  {
  case WM_PAINT:
   HDC hdc;
       PAINTSTRUCT ps;
   hdc=BeginPaint(hwnd,&ps);
   TextOut(hdc,0,0,"毛毛雨系列",strlen("毛毛雨系列"));
   EndPaint(hwnd,&ps);
   break;
  case WM_CLOSE:
   DestroyWindow(hwnd);
   break;
  case WM_DESTROY:
   PostQuitMessage(0);
   break;
  default: return DefWindowProc(hwnd,uMsg,wParam,lParam);
  
  };
return 0;}

解决方案 »

  1.   

    你写法错误了,
    {
    LRESULT CALLBACK myProc(
      HWND hwnd,      // handle to window
      UINT uMsg,      // message identifier
      WPARAM wParam,  // first message parameter
      LPARAM lParam   // second message parameter
    );
    WNDCLASS wlass;
    此处的myProc是声明,应把
    LRESULT CALLBACK myProc(
      HWND hwnd,      // handle to window
      UINT uMsg,      // message identifier
      WPARAM wParam,  // first message parameter
      LPARAM lParam   // second message parameter
    );
    移到
    #include<windows.h>
    #include<stdio.h>
    这两行的后面即可。