【发布时间】:2014-12-22 10:07:26
【问题描述】:
我有问题。我想记录我的工具开发,所以我想让窗口名称带有日期和时间数据,而不是在屏幕截图上 mspaint-ing 日期。但不是字符串,我只有中文字符。
这是我想将字符串分配给 CreateWindowEx() 的代码:
char *wndName = "Asphyx V0.01 (Build Date: " __DATE__ " " __TIME__ ")\0";
hWnd = CreateWindowEx(NULL,
L"WindowClass",
(LPCWSTR)wndName,
WS_OVERLAPPEDWINDOW,
300,
300,
wr.right - wr.left,
wr.bottom - wr.top,
NULL,
NULL,
hInstance,
NULL);
编辑:伙计们,我很欣赏你的回答,但他们都给了我这个
Error 29 error C2308: concatenating mismatched strings
唯一有用的东西是一个尚未删除的答案,但它给了我这个:
他使用了这个代码:
char title[256];
sprintf(title, "Asphyx V0.01 (Build Date: %s - %s)", __DATE__, __TIME__);
hWnd = CreateWindowEx(NULL,
L"WindowClass",
title,
WS_OVERLAPPEDWINDOW,
300,
300,
wr.right - wr.left,
wr.bottom - wr.top,
NULL,
NULL,
hInstance,
NULL);
【问题讨论】:
-
选角不好,mmkay。
-
还加一个供南方公园参考:D
-
为了完整性,而不是因为这是一个好主意,解决问题的另一种方法是调用
CreateWindowExA而不是CreateWindowEx。
标签: c++ winapi direct3d createwindowex