problem with api messagebox
-
i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?
-
i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?
You can only pass a single string to the
MessageBox()
function. Usesprintf()
or the appropriate variant to create a single character array containing your complete message.Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?
Hi, The problem is with your conversion.. Cheers
-
i want to print two parameter from my struct but it doesnt print to me GetWindowText(hwndEdit[0],arr.last,10); GetWindowText(hwndEdit[1],arr.first,10); MessageBox(hwnd,TEXT((LPCWSTR)arr.last(LPCWSTR)arr.first),TEXT("bla"),MB_OK); how can i fix\what is the syntax ?
You need to concatenate the strings first before you call
MessageBox
. As Richard said, you can usesprintf
to do this. If you have wide character strings, you must use theswprintf
function instead. You could also use the_stprintf
(or_stprintf_s
) macro which would cater for bothsprintf
(sprintf_s
) orswprintf
(swprintf_s
) depending on whetherUNICODE
is defined. You can also use the_tcscat
(or_tcscat_s
) macro to do this. Other options are to use theCString += operator
or thestd::wstring += operator
.«_Superman_» _I love work. It gives me something to do between weekends.