
LRESULT CALLBACK WndProc(HWND, UINT,WPARAM,LPARAM);
#include<windows.h>#include"stdafx.h"LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);...
#include <windows.h>
#include "stdafx.h"
LRESULT CALLBACK WndProc(HWND, UINT,WPARAM,LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wndclass;
HWND hwnd;
MSG msg;
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "windows 创建窗口!";
if(!RegisterClass(&wndclass)) return FALSE;
hwnd=CreateWindow("windows 创建窗口!","windows 创建窗口",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM 45 lParam)
{
switch(message)
{
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,10,20,"哈哈,windows 编程创建的窗口!", 28);
EndPaint(hdc,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
编译出错:
1.windemo\windemo.cpp(45) : error C2143: syntax error : missing ')' before 'constant'
2.error C2143: syntax error : missing ';' before 'constant'
3.fatal error C1004: unexpected end of file found
请帮我找下错误,
调试了几次都不对,尤其第三个错误,头文件我也包含进来了 展开
#include "stdafx.h"
LRESULT CALLBACK WndProc(HWND, UINT,WPARAM,LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wndclass;
HWND hwnd;
MSG msg;
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "windows 创建窗口!";
if(!RegisterClass(&wndclass)) return FALSE;
hwnd=CreateWindow("windows 创建窗口!","windows 创建窗口",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM 45 lParam)
{
switch(message)
{
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,10,20,"哈哈,windows 编程创建的窗口!", 28);
EndPaint(hdc,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
编译出错:
1.windemo\windemo.cpp(45) : error C2143: syntax error : missing ')' before 'constant'
2.error C2143: syntax error : missing ';' before 'constant'
3.fatal error C1004: unexpected end of file found
请帮我找下错误,
调试了几次都不对,尤其第三个错误,头文件我也包含进来了 展开
3个回答
展开全部
#include <windows.h>
#include "stdafx.h"
LRESULT CALLBACK WndProc(HWND, UINT,WPARAM,LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wndclass;
HWND hwnd;
MSG msg;
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "windows 创建窗口!";
if(!RegisterClass(&wndclass)) return FALSE;
hwnd=CreateWindow("windows 创建窗口!","windows 创建窗口",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,10,20,"哈哈,windows 编程创建的窗口!",28);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
#include "stdafx.h"
LRESULT CALLBACK WndProc(HWND, UINT,WPARAM,LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wndclass;
HWND hwnd;
MSG msg;
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "windows 创建窗口!";
if(!RegisterClass(&wndclass)) return FALSE;
hwnd=CreateWindow("windows 创建窗口!","windows 创建窗口",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,10,20,"哈哈,windows 编程创建的窗口!",28);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
展开全部
两个错误。
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
//哪里跑出来个45?
EndPaint(hwnd,&ps);//要用窗口句柄
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
//哪里跑出来个45?
EndPaint(hwnd,&ps);//要用窗口句柄
更多追问追答
追问
编译仍是这三个问题,还有我是初学MFC ,45我也不明白什么意思,照教材上敲的,不过去掉45 编译又出新错。能说说第三个错误“fatal error C1004: unexpected end of file found ” 问题出在哪里吗
追答
我这不出问题了,编译通过。
那三个错误就是45造成的,整个代码逻辑上,这里多出东西,就匹配不上了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你双击
windemo\windemo.cpp(45) : error C2143: syntax error : missing ')' before 'constant'
这一行,再把问题所在的代码贴出来
windemo\windemo.cpp(45) : error C2143: syntax error : missing ')' before 'constant'
这一行,再把问题所在的代码贴出来
追问
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM 45 lParam)
去掉45可以通过了,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询