Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
C++
case WM_COMMAND:
           switch (LOWORD (wParam))
           {
               case IDC_PLAY:
                   static char textmessage[256];
                   SendMessage((HWND)lParam,WM_GETTEXT,(WPARAM)256,(LPARAM)textmessage);
                   MessageBox(NULL,textmessage,NULL,NULL);
                   if(textmessage=="PLAY")
                   {
                                        SetWindowText((HWND)lParam,"Stop");

                   }



I am not entering in to the if though its "PLAY";
How to compare exactly this. I am new to use such cases for WM_COMMAND and sendMessage
Posted
Updated 9-May-12 0:57am
v2

1 solution

change

from
C++
if(textmessage=="PLAY")


to
C++
if( strncmp(textmessage, "PLAY", 4) == 0 )



(or use a CString).
 
Share this answer
 
Comments
chaiein 9-May-12 7:46am    
Thank you:) it works
CPallini 9-May-12 7:54am    
Are you surprised? :-D
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900