请教下面错误
程序如下:
typedef struct
{
HWND hWnd;
char cWinBuf[256];
}WINLIST;
WINLIST gWinList[256];
int giCountWin,j;
BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
{
char buffer[256];
GetWindowText(hWnd, buffer, 256);
if ( strlen(buffer) )
{
if (giCountWin < 256)
{
gWinList[ giCountWin].hWnd = hWnd;
strcpy(gWinList[ giCountWin].cWinBuf,buffer);
giCountWin ++;
}
}
return TRUE;
}
void CloseSpedia()
{
giCountWin = 0;
EnumWindows( (WNDENUMPROC)EnumWindowsProc,0);
for ( j = 0; j<giCountWin; j++)
{
if ( strcmp(gWinList[j].cWinBuf,"画笔") == 0 )
{
::PostMessage( gWinList[j].hWnd,WM_CLOSE,0,0);
break;
}
}
}
但编译时出现了一大堆形如 error C2018: unknown character '0xa1'
之类的错误,这些错误一般是在有HWND、hWnd处出现的,是不是少了什么头文件?
HWND是怎样用的?
问题点数:20、回复次数:4Top
1 楼imacih()回复于 2001-10-13 13:30:08 得分 0
帮帮忙啦,大侠!Top
2 楼a813(周)回复于 2001-10-13 13:38:39 得分 20
改正如下,主要是每行前有些字符不对,删除后通过
typedef struct
{HWND hWnd;
char cWinBuf[256];
}WINLIST;
WINLIST gWinList[256];
int giCountWin,j;
BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
{
char buffer[256];
GetWindowText(hWnd, buffer, 256);
if(strlen(buffer))
{
if (giCountWin < 256)
{
gWinList[ giCountWin].hWnd = hWnd;
strcpy(gWinList[ giCountWin].cWinBuf,buffer);
giCountWin ++;
}
}
return TRUE;
}
void CloseSpedia()
{
giCountWin = 0;
EnumWindows( (WNDENUMPROC)EnumWindowsProc,0);
for ( j = 0; j<giCountWin; j++)
{
if (strcmp(gWinList[j].cWinBuf,"画笔") == 0 )
{
::PostMessage( gWinList[j].hWnd,WM_CLOSE,0,0);
break;
}
}
}Top
3 楼imacih()回复于 2001-10-13 14:04:52 得分 0
谢谢你了,a813,我给了你20分。但还是问一下,有什么字符不对吗?我可一点也看不出啊,我是上网下载这代码的。Top
4 楼zdl(zx)回复于 2001-10-13 14:09:29 得分 0
下载的程序里面包含有全角字符,显示时是看不见的Top




