为什么我编译过了一运行程序会这样???提示我不能将参数 2 从“const char [3]”转换为“LPCWSTR”

暗示的味道 2014-11-05 01:53:45
前面的注册窗口类的就不写了

void time(HDC hdc,int cxclient ,int cyclient)
{
SetMapMode(hdc,MM_TEXT);
SetViewportOrgEx(hdc,cxclient/2,cyclient/2,NULL);
}

LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
static int s,f,m;
int cxclient,cyclient;---------就是这个变量?
TCHAR sbufs[256];
TCHAR sbuff[256];
TCHAR sbufm[256];
switch(message)
{
case WM_CREATE:
SetTimer(hwnd,1,1000,NULL);
return 0;
case WM_SIZE:
cxclient=LOWORD(lParam);
cyclient=HIWORD(lParam);
return 0;
case WM_TIMER:
hdc=GetDC(hwnd);
time(hdc,cxclient,cyclient);
switch(wParam)
{
case 1:
for(s=0;s<25;s++)
{
int size;
size=wsprintf(sbufs,"%d",s);
TextOut(hdc,0,0,sbuff,size);
for(f=0;f<61;f++)
{

int size;
size=wsprintf(sbuff,"%d",f);
TextOut(hdc,10,0,sbuff,size);
for(m=0;m<61;m++)
{
int size;

size=wsprintf(sbufm,"%d",m);
TextOut(hdc,20,0,sbuff,size);
}
}
}
}
return 0;

case WM_DESTROY:
PostQuitMessage(0);

return 0;
}

return DefWindowProc(hwnd,message,wParam,lParam);
}
出现错误?另外我想问问wprintf的意义和用法?
...全文
287 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-11-22
  • 打赏
  • 举报
回复
英语也是一门计算机语言的说。
ForestDB 2014-11-10
  • 打赏
  • 举报
回复
按老赵的说法,英语也是一种语言的说。
暗示的味道 2014-11-09
  • 打赏
  • 举报
回复
在time这个函数上发生的错误??按说我已经初始化了cx和cy了啊?
暗示的味道 2014-11-09
  • 打赏
  • 举报
回复
按你这么说错误在注册窗口类上??是缓冲区上的问题吗?在缓冲区输出后是不是自动清除?
暗示的味道 2014-11-08
  • 打赏
  • 举报
回复
程序把wsprintf改成wprintf后出现未初始化变量,就程序标注的那个变量。我找不见在哪未初始化???
暗示的味道 2014-11-08
  • 打赏
  • 举报
回复
神啊!能整点中文吗?英语刚跌破高中,在小学套牢
ID870177103 2014-11-08
  • 打赏
  • 举报
回复
warning C4700: 使用了未初始化的局部变量“cyclient” warning C4700: 使用了未初始化的局部变量“cxclient” 其它关于Unicode和Ascii的兼容宏是没问题的 错误不在这段代码中
赵4老师 2014-11-05
  • 打赏
  • 举报
回复
Stream I/O These functions process data in different sizes and formats, from single characters to large data structures. They also provide buffering, which can improve performance. The default size of a stream buffer is 4K. These routines affect only buffers created by the run-time library routines, and have no effect on buffers created by the operating system. Stream I/O Routines Routine Use clearerr Clear error indicator for stream fclose Close stream _fcloseall Close all open streams except stdin, stdout, and stderr _fdopen, wfdopen Associate stream with handle to open file feof Test for end of file on stream ferror Test for error on stream fflush Flush stream to buffer or storage device fgetc, fgetwc Read character from stream (function versions of getc and getwc) _fgetchar, _fgetwchar Read character from stdin (function versions of getchar and getwchar) fgetpos Get position indicator of stream fgets, fgetws Read string from stream _fileno Get file handle associated with stream _flushall Flush all streams to buffer or storage device fopen, _wfopen Open stream fprintf, fwprintf Write formatted data to stream fputc, fputwc Write a character to a stream (function versions of putc and putwc) _fputchar, _fputwchar Write character to stdout (function versions of putchar and putwchar) fputs, fputws Write string to stream fread Read unformatted data from stream freopen, _wfreopen Reassign FILE stream pointer to new file or device fscanf, fwscanf Read formatted data from stream fseek Move file position to given location fsetpos Set position indicator of stream _fsopen, _wfsopen Open stream with file sharing ftell Get current file position fwrite Write unformatted data items to stream getc, getwc Read character from stream (macro versions of fgetc and fgetwc) getchar, getwchar Read character from stdin (macro versions of fgetchar and fgetwchar) gets, getws Read line from stdin _getw Read binary int from stream printf, wprintf Write formatted data to stdout putc, putwc Write character to a stream (macro versions of fputc and fputwc) putchar, putwchar Write character to stdout (macro versions of fputchar and fputwchar) puts, _putws Write line to stream _putw Write binary int to stream rewind Move file position to beginning of stream _rmtmp Remove temporary files created by tmpfile scanf, wscanf Read formatted data from stdin setbuf Control stream buffering _setmaxstdio Set a maximum for the number of simultaneously open files at the stream I/O level. setvbuf Control stream buffering and buffer size _snprintf, _snwprintf Write formatted data of specified length to string sprintf, swprintf Write formatted data to string sscanf, swscanf Read formatted data from string _tempnam, _wtempnam Generate temporary filename in given directory tmpfile Create temporary file tmpnam, _wtmpnam Generate temporary filename ungetc, ungetwc Push character back onto stream vfprintf, vfwprintf Write formatted data to stream vprintf, vwprintf Write formatted data to stdout _vsnprintf, _vsnwprintf Write formatted data of specified length to buffer vsprintf, vswprintf Write formatted data to buffer When a program begins execution, the startup code automatically opens several streams: standard input (pointed to by stdin), standard output (pointed to by stdout), and standard error (pointed to by stderr). These streams are directed to the console (keyboard and screen) by default. Use freopen to redirect stdin, stdout, or stderr to a disk file or a device. Files opened using the stream routines are buffered by default. The stdout and stderr functions are flushed whenever they are full or, if you are writing to a character device, after each library call. If a program terminates abnormally, output buffers may not be flushed, resulting in loss of data. Use fflush or _flushall to ensure that the buffer associated with a specified file or all open buffers are flushed to the operating system, which can cache data before writing it to disk. The commit-to-disk feature ensures that the flushed buffer contents are not lost in the event of a system failure. There are two ways to commit buffer contents to disk: Link with the file COMMODE.OBJ to set a global commit flag. The default setting of the global flag is n, for “no-commit.” Set the mode flag to c with fopen or _fdopen. Any file specifically opened with either the c or the n flag behaves according to the flag, regardless of the state of the global commit/no-commit flag. If your program does not explicitly close a stream, the stream is automatically closed when the program terminates. However, you should close a stream when your program finishes with it, as the number of streams that can be open at one time is limited. See _setmaxstdio for information on this limit. Input can follow output directly only with an intervening call to fflush or to a file-positioning function (fseek, fsetpos, or rewind). Output can follow input without an intervening call to a file-positioning function if the input operation encounters the end of the file. String Manipulation These routines operate on null-terminated single-byte character, wide-character, and multibyte-character strings. Use the buffer-manipulation routines, described in Buffer Manipulation, to work with character arrays that do not end with a null character. String-Manipulation Routines Routine Use _mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll Compare two multibyte-character strings using multibyte code page information (_mbsicoll and _mbsnicoll are case-insensitive) _mbsdec, _strdec, _wcsdec Move string pointer back one character _mbsinc, _strinc, _wcsinc Advance string pointer by one character _mbslen Get number of multibyte characters in multibyte-character string; dependent upon OEM code page _mbsnbcat Append, at most, first n bytes of one multibyte-character string to another _mbsnbcmp Compare first n bytes of two multibyte-character strings _mbsnbcnt Return number of multibyte-character bytes within supplied character count _mbsnbcpy Copy n bytes of string _mbsnbicmp Compare n bytes of two multibyte-character strings, ignoring case _mbsnbset Set first n bytes of multibyte-character string to specified character _mbsnccnt Return number of multibyte characters within supplied byte count _mbsnextc, _strnextc, _wcsnextc Find next character in string _mbsninc. _strninc, _wcsninc Advance string pointer by n characters _mbsspnp, _strspnp, _wcsspnp Return pointer to first character in given string that is not in another given string _mbstrlen Get number of multibyte characters in multibyte-character string; locale-dependent sprintf, _stprintf Write formatted data to a string strcat, wcscat, _mbscat Append one string to another strchr, wcschr, _mbschr Find first occurrence of specified character in string strcmp, wcscmp, _mbscmp Compare two strings strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll, _strnicoll, _wcsnicoll Compare two strings using current locale code page information (_stricoll, _wcsicoll, _strnicoll, and _wcsnicoll are case-insensitive) strcpy, wcscpy, _mbscpy Copy one string to another strcspn, wcscspn, _mbscspn, Find first occurrence of character from specified character set in string _strdup, _wcsdup, _mbsdup Duplicate string strerror Map error number to message string _strerror Map user-defined error message to string strftime, wcsftime Format date-and-time string _stricmp, _wcsicmp, _mbsicmp Compare two strings without regard to case strlen, wcslen, _mbslen, _mbstrlen Find length of string _strlwr, _wcslwr, _mbslwr Convert string to lowercase strncat, wcsncat, _mbsncat Append characters of string strncmp, wcsncmp, _mbsncmp Compare characters of two strings strncpy, wcsncpy, _mbsncpy Copy characters of one string to another _strnicmp, _wcsnicmp, _mbsnicmp Compare characters of two strings without regard to case _strnset, _wcsnset, _mbsnset Set first n characters of string to specified character strpbrk, wcspbrk, _mbspbrk Find first occurrence of character from one string in another string strrchr, wcsrchr,_mbsrchr Find last occurrence of given character in string _strrev, _wcsrev,_mbsrev Reverse string _strset, _wcsset, _mbsset Set all characters of string to specified character strspn, wcsspn, _mbsspn Find first substring from one string in another string strstr, wcsstr, _mbsstr Find first occurrence of specified string in another string strtok, wcstok, _mbstok Find next token in string _strupr, _wcsupr, _mbsupr Convert string to uppercase strxfrm, wcsxfrm Transform string into collated form based on locale-specific information vsprintf, _vstprint Write formatted output using a pointer to a list of arguments
robertbo 2014-11-05
  • 打赏
  • 举报
回复
你的工程是UNICODE的吧,wsprintf和sprintf的功能是一样的,就是用于打印宽字节字符,处理wchar_t类型的字符串。
暗示的味道 2014-11-05
  • 打赏
  • 举报
回复
那wprintf能详解一下吗?
xionggch 2014-11-05
  • 打赏
  • 举报
回复
wsprintf(sbufs,"%d",s);是宽字节模式 改成 wsprintf(sbufs,L"%d",s);
内容概要:《绿色转型美丽乡村——汾渭平原地区低碳乡村案例集》由西安空气侠环保科技有限公司编写,北京市企业家环保基金支持,聚焦汾渭平原地区乡村低碳发展的典型实践。报告梳理了国内外相关理论研究及政策背景,展示了中央与地方在低碳乡村发展方面的政策措施。通过五个典型案例,包括芮城县庄上村的“光储直柔”模式、铜川耀州区克坊村的“光伏+普惠金融”、浮山县臣南河村的循环经济模式、澄城县权家河村的“风光储一体化”以及麟游县紫石崖村的“光伏+生态养殖”,详细分析了这些案例的技术路线、项目成效、主要政策、典型经验和存在问题。报告总结了清洁能源在乡村低碳发展中的核心地位,强调了因地制宜发展策略的关键作用,并指出了多重效益综合追求的重要性。 适合人群:从事环保、农业、能源领域研究的专业人士,以及关注乡村低碳发展和可持续发展的政策制定者和社学者。 使用场景及目标:①为全国其他地区开展乡村能源转型实践提供有益的借鉴;②助力推动我国乡村低碳发展,为实现碳达峰、碳中和目标贡献积极力量;③为政策制定者提供决策参考,促进乡村绿色转型和乡村振兴战略的实施。 其他说明:报告由多家单位参编,感谢北京市企业家环保基金提供资金支持。文中内容及意见仅代表作者的个人观点,与北京市企业家环保基金的立场或政策无关。报告期望为全国其他地区开展乡村能源转型实践提供有益的借鉴,助力推动我国乡村低碳发展。

33,322

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧