GetUserName不接受2个参数 [英] GetUserName does not take 2 arguments

查看:163
本文介绍了GetUserName不接受2个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在MFC应用程序中实现GetUserName函数,但收到错误消息"GetUserNameA":函数没有2个参数".

以下是代码段.

Hi folks,

I am trying to implement GetUserName function in an MFC app but was given an error that "GetUserNameA'' : function does not take 2 arguments".

Below is the snippet.

#define INFO_BUFFER_SIZE 32767
TCHAR  infoBuf[INFO_BUFFER_SIZE];
DWORD  bufCharCount = INFO_BUFFER_SIZE;
GetUserName(infoBuf, &bufCharCount);



谢谢.



Thanks.

推荐答案

好吧,它正在调用函数的ansi版本,并且您正在使用类型为TCHAR的缓冲区.尝试将其更改为char类型并查看是否可行...
Well, it''s calling the ansi version of the function, and you''re using a buffer of type TCHAR. Try changing it to a char type ans see if that works...


根据MSDN [
According to MSDN[^] it does; are you sure it has not been redefined somewhere?


约翰,

尝试过您的建议,但仍无法解决错误.理查德(Richard),在其他任何地方都没有重新定义它.

请使用任何其他可能的解决方案.

谢谢.
Hi John,

Have tried your suggestion, but still doesn''t resolve the error. And Richard, have not redefined it anywhere else.

Any other possible solution please.

Thanks.


这篇关于GetUserName不接受2个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆