| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 770 人关注过本帖
标题:这个程序有错吗?
只看楼主 加入收藏
lcnhyf1986
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-16
收藏
 问题点数:0 回复次数:6 
这个程序有错吗?

#include <windows.h>
#include <stdlib.h>
#include <string.h>
BOOL Init WindowsClass(HINSTANCE hInstance);
BOOL Init Windows(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MSG Message;
if(!InitWindowsClass(hInstnce ,nCmdShow))
return FALSE;
if(! InieWindows(hInstance,nCmdShow))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd,UNIT iMessage,UNIT wParam,LONG lParam)
{
WORD x,y;
HCURSOR hCursor;
switch(iMessage)
{
case WM_MOUSEMOVE:
x=LOWORD(lParam);
y=HIWORD(iParam);
if(x>=50&&x<=400&&y>=50&&y<=300)
{
if(x>=50&&x<=100&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_CROSS);
SetCursor(hCursor);
}
if(x>=100&&x<=150&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_SIZEALL);
SetCursor(hCursor);
}
if(x>=150&&x<=200&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_HELP);
SetCursor(hCursor);
}
if(x>=50&&x<=100&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENESW);
SetCursor(hCursor);
}
if(x>=100&&x<=250&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENS);
SetCursor(hCursor);
}
if(x>=250&&x<=400&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENWSE);
SetCursor(hCursor);
}
if(x>=50&&x<=100&&y>=150&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_SIZEWE);
SetCursor(hCursor);
}
if(x>=100&&x<=250&&y>=100&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_UPARROW);
SetCursor(hCursor);
}
if(x>=250&&x<=400&&y>=150&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_WAIT);
SetCursor(hCursor);
}
}
else
{
hCursor=LoadCursor(NULL,IDC_ARROW);
SetCursor(hCursor);
}
return 0;
case WM_DESTROY:
PoseQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
}
BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS Wndclass;
WndClass.cbClsExtra=0;
WndClass.hbrBackground=(HBRUSH)(GetStockObject(WHILE_BRUSH));
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=loadCursor(NULL,"END");
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName="WinMouse";
Wndclass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAM|CS_VREDRAW;
return RegisterClass(&WndClass);
}

BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd;
hWnd=CreateWindow("WinMouse",
"鼠标及光标形状设置示例",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULE,0,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}

搜索更多相关主题的帖子: Windows return 
2007-05-03 21:58
边城路人
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:9
帖 子:591
专家分:0
注 册:2007-3-8
收藏
得分:0 
出现什么问题了吗?

当你开始怀疑自己时,说明你已经失去了判断力
2007-05-04 08:06
lcnhyf1986
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-16
收藏
得分:0 

#include <stdafx.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
BOOL InitWindowsClass(HINSTANCE hInstance);
BOOL InitWindows(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MSG Message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(! InitWindows(hInstance, nCmdShow))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam)
{
WORD x,y;
HCURSOR hCursor;
switch(iMessage)
{
case WM_MOUSEMOVE:
x=LOWORD(lParam);
y=HIWORD(lParam);
if(x>=50&&x<=400&&y>=50&&y<=300)
{
if(x>=50&&x<=100&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_CROSS);
SetCursor(hCursor);
}
if(x>=100&&x<=150&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_SIZEALL);
SetCursor(hCursor);
}
if(x>=150&&x<=200&&y>=50&&y<=100)
{
hCursor=LoadCursor(NULL,IDC_HELP);
SetCursor(hCursor);
}
if(x>=50&&x<=100&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENESW);
SetCursor(hCursor);
}
if(x>=100&&x<=250&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENS);
SetCursor(hCursor);
}
if(x>=250&&x<=400&&y>=100&&y<=150)
{
hCursor=LoadCursor(NULL,IDC_SIZENWSE);
SetCursor(hCursor);
}
if(x>=50&&x<=100&&y>=150&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_SIZEWE);
SetCursor(hCursor);
}
if(x>=100&&x<=250&&y>=100&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_UPARROW);
SetCursor(hCursor);
}
if(x>=250&&x<=400&&y>=150&&y<=300)
{
hCursor=LoadCursor(NULL,IDC_WAIT);
SetCursor(hCursor);
}
}
else
{
hCursor=LoadCursor(NULL,IDC_ARROW);
SetCursor(hCursor);
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
}
BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS WndClass;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)(GetStockObject(WHITE_BRUSH));
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=LoadCursor(NULL,"END");
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName="WinMouse";
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&WndClass);
}

BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd;
hWnd=CreateWindow("WinMouse",
"鼠标及光标形状设置示例",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,0,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}



提示:
Compiling...
ewr.cpp
c:\documents and settings\liuchengning\桌面\wre\ewr.cpp(11) : error C2660: 'InitWindows' : function does not take 2 parameters
执行 cl.exe 时出错.

wre.exe - 1 error(s), 0 warning(s)

2007-05-04 12:34
lcnhyf1986
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-16
收藏
得分:0 
我是在VC6.0里运行的.
2007-05-04 12:35
lcnhyf1986
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-16
收藏
得分:0 
怎么没人救?
2007-05-05 10:19
hydrone
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-11-10
收藏
得分:0 
BOOL InitWindows(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
与if(! InitWindows(hInstance, nCmdShow))
return FALSE;
两个InitWindows函数的参数个数不同就是这个出错!

2007-05-05 19:07
lcnhyf1986
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-3-16
收藏
得分:0 

谢谢提醒

2007-05-06 00:15
快速回复:这个程序有错吗?
数据加载中...
 
   



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

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