我開發的計算器應用程序作爲一門功課,並和我檢查時按下的數字是這樣的:轉換LOWORD(wParam參數)到常量爲wchar_t *
if (LOWORD(wParam) == buttonDigit0) {
writeToOperand(L"0");
}
else if (LOWORD(wParam) == buttonDigit1) {
writeToOperand(L"1");
}
else if (LOWORD(wParam) == buttonDigit2) {
writeToOperand(L"2");
}
// ...
哪裏writeToOperand
是void writeToOperand(const wchar_t* digit);
而且我要來縮小它是這樣的:
if (LOWORD(wParam) >= 100 && LOWORD(wParam) <= 109) {
writeToOperand(LOWORD(wParam));
}
哪裏100
是按鈕#define buttonDigit0 100
的ID和109
是#define buttonDigit9 109
。 但我不關注如何將LOWORD(wParam)
轉換爲const wchar_t*
用於我的writeToOperand
函數。
'std :: to_wstring()' –
LOWORD是低16位,這怎麼可能是一個32/64位地址?它應該將值轉換爲字符串 –
@JonathanPotter謝謝! – rel1x