| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2376 人关注过本帖
标题:[求助]一个简单的VC语法,照抄的,但是不知道错在哪
只看楼主 加入收藏
donghuikmo
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-10-26
收藏
 问题点数:0 回复次数:0 
[求助]一个简单的VC语法,照抄的,但是不知道错在哪
#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinsunProc(
    HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lparam
)

int WinApi WinMain(                  //出问题的地方是这一行开始
hinstance hinstance,  
hinstance hprevinstance,
lpstr lpcmdline,
    int ncmdshow
)   
{
    wndclass wndcls;
wndcls.cbclsextra=0;
wndcls.cbwndextra=0;
wndcls.hbrbackground=(hbrush)getstockobject(black_brush);
wndcls.hcursor=loadcursor(null,idc_cross);
wndcls.hicon=loadicon(null,idi_error);
wndcls.hinstance=hinstance;
wndcls.lpfnwndproc=winsunproc;
wndcls.lpszclassname="weixin2008";
wndcls.lpszmenuname=null;
wndcls.style=cs_hredraw | cs_vredraw;
    registerclass(&wndcls);


hwnd hwnd;
hwnd=createwindow("weixin2003","维新学习",ws_overlappedwindow,0.0,600,400,null,null,hinstance,null);
showwindow(hwnd,sw_shownormall);
updatewindow(hwnd);

msg msg;
while(getmessage(&msg,null,0,0))
{
      Translatemessage(&msg);
  dispatchmessage(&msg);
}
return 0;
}   
LRESULT CALLBACK WinsunProc(
    HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lparam
)
{
    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;
}   


--------------------Configuration: O1 - Win32 Debug--------------------
Compiling...
o1.cpp
E:\VCe\O1\o1.cpp(11) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
E:\VCe\O1\o1.cpp(11) : error C2146: syntax error : missing ';' before identifier 'WinApi'
E:\VCe\O1\o1.cpp(11) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

O1.exe - 2 error(s), 1 warning(s)
搜索更多相关主题的帖子: 语法 
2008-10-26 01:02
快速回复:[求助]一个简单的VC语法,照抄的,但是不知道错在哪
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022562 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved