在WinCE上用C++构造一个LPCWSTR (Zune/ZDK)
在 WinCE 6 上构建 LPCWSTR 的好方法是什么?我想在 C# 中找到类似于 String.Format() 的东西。我的尝试是:
OSVERSIONINFO vi;
memset (&vi, 0, sizeof vi);
vi.dwOSVersionInfoSize = sizeof vi;
GetVersionEx (&vi);
char buffer[50];
int n = sprintf(buffer, "The OS version is: %d.%d", vi.dwMajorVersion, vi.dwMinorVersion);
ZDKSystem_ShowMessageBox(buffer, MESSAGEBOX_TYPE_OK);
ZDKSystem_ShowMessageBox 指的是被黑的 Zunes 的 ZDK,可在以下位置找到: http://zunedevwiki.org
这行代码与消息框调用配合得很好:
ZDKSystem_ShowMessageBox(L"Hello Zune", MESSAGEBOX_TYPE_OK);
我的基本目标是查看在 Zune HD 上运行的 WinCE 的确切版本,以查看哪些功能可用(即是 R2 或更早版本?)。
另外我还没有看到 ZDK 的任何标签,所以如果有更合适的东西请编辑!
What's a good way to construct an LPCWSTR on WinCE 6? I'd like to find something similar to String.Format() in C#. My attempt is:
OSVERSIONINFO vi;
memset (&vi, 0, sizeof vi);
vi.dwOSVersionInfoSize = sizeof vi;
GetVersionEx (&vi);
char buffer[50];
int n = sprintf(buffer, "The OS version is: %d.%d", vi.dwMajorVersion, vi.dwMinorVersion);
ZDKSystem_ShowMessageBox(buffer, MESSAGEBOX_TYPE_OK);
That ZDKSystem_ShowMessageBox refers to the ZDK for hacked Zunes available at:
http://zunedevwiki.org
This line of code works well with the message box call:
ZDKSystem_ShowMessageBox(L"Hello Zune", MESSAGEBOX_TYPE_OK);
My basic goal is to look at the exact version of WinCE running on a Zune HD to see which features are available (i.e. is it R2 or earlier?).
Also I haven't seen any tags for the ZDK so please edit if something is more fitting!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
sprintf 用于窄字符串。
LPCWSTR
是一个const WCHAR *
,因此您需要宽字符和正确的函数。例如
或使用通用文本函数,并使用 UNICODE 进行编译,
(您还可以使用其他函数,例如
_stprintf_s
、swprintf_s
等)sprintf is for narrow strings.
LPCWSTR
is aconst WCHAR *
, so you need wide characters, and the right function.E.g.
or using generic text functions, and compiling with UNICODE,
(There are other functions you could use, such as
_stprintf_s
,swprintf_s
, etc)