回 帖 发 新 帖 刷新版面

主题:帮忙看一下哪错了

#include<Windows.h>
#include<stdio.h>
LRESULT CALLBACK WinlSunProc
(
  HWND hwnd,
  UINT uMsg,
  WPARAM wParam,
  LPARAM lParam
);

 int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow);
 {

   WNDCLASS wndclas;
   wndclas.cbClsExtra=0;
   wndclas.cbWndExtra=0;
   wndclas.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
   wndclas.hCursor=LoadCursor(NULL,IDC_CROSS);
   wndclas.hIcon=LoadIcon(NULL,IDI_ERROR);
   wndclas.hInstance=hInstance;
   wndclas.lpfnWndProc=WinSunProc;
   wndclas.lpszClassName="sunxin";
   wndclas.lpszMenuName=NULL;
   wndclas.style=CS_HREDRAW|CS_VREDRAW;
   RegisterClass(&wndclas);
   HWND hwnd;
   hwnd=CreateWindow("sunxin","zijidongshou",WS_OVERLAPEDWINDOW,0,0,500,500,NULL,NULL,hInstance,NULL);
   ShowWindow(hwnd,SW_SHOWNORMAL);
   UpdateWindow(hwnd);
   MSG msg;
   while(GetMessage(&msg,NULL,0,0))
   {
    TranslateMessage(&msg);
    DispatchMessage(&msg);

   }

    return msg.wParam;
 }

 LRESULT CALLBACK WinSunProc
     (HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
 {
 switch(uMsg)
 {
 case WM_CHAR:
     char szchar[20];
     sprintf(szchar,"char code is %d",wParam);
     MessageBox(hwnd,szchar,"char",0);
     break;
 case WM_LBUTTONDOWN:
     MessageBox(hwnd,"mouse clicked","message",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,"是否真的结束?","message",MB_YESNO))
    {
     DestroyWindow(hwnd);

    }
      break;
case WM_DESTROY:
    PostQuitMessage(0);
    break;
default:
    return DefWindowProc(hwnd,uMsg,wParam,lParam);

}
 
 return 0;
 }
就一个错误找不到郁闷呀

回复列表 (共5个回复)

沙发

LRESULT CALLBACK WinlSunProc
LRESULT CALLBACK WinSunProc
     (HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
我只看了10几秒。。。

板凳

现在很多人都是这样,自己根本不怎么思考,随便就拿上来问别人.

3 楼


还有错误呀,再麻烦一下。小弟初学VC,原理都不太懂,不要笑话,呵呵

4 楼

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow);//把分号去掉
hwnd=CreateWindow("sunxin","zijidongshou",WS_OVERLAPEDWINDOW,0,0,500,500,NULL,NULL,hInstance,NULL);函数参数不对
LRESULT CALLBACK WinlSunProc声明的函数名错误
真就不明白了,编译器都说的明明白白的,怎么还能找不到错误

5 楼

你好.我是全职网赚工作者.
如果你有时间有电脑.
想在网络上创业.请联系我..
项目绝对真实.详情QQ空间资料
加盟请联系 QQ908889846

我来回复

您尚未登录,请登录后再回复。点此登录或注册