开发者

how i show a dWord value in Messagebox api function

开发者 https://www.devze.com 2023-01-11 15:53 出处:网络
i want show a message dialog with a dword value like this MessageBox(0, (LPCWSTR) hProcess,TEXT(\"My MessageBox Info\"),MB_OK | MB_ICONERROR);

i want show a message dialog with a dword value like this

MessageBox(0, (LPCWSTR) hProcess ,TEXT("My MessageBox Info"),MB_OK | MB_ICONERROR);

hProcess is a DWORD value but it when messag开发者_StackOverflow社区ebox appear , body part of message that should show dowrd value is empty.


TCHAR msg[100];

StringCbPrintf(msg, 100, TEXT("%d"), hProcess);

MessageBox(NULL, msg, TEXT("My MessageBox Info"), MB_OK | MB_ICONERROR);


char *s = (char*)malloc(10);
sprintf(s, "%d", hProcess);
MessageBox(NULL, s, ...);
free(s);


First convert the value to a string, then display it in message box.

Take a look at this: ultoa

0

精彩评论

暂无评论...
验证码 换一张
取 消