Click here to Skip to main content
12,241,814 members (44,234 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ MFC VC9.0 VisualC++
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 9-May-12 1:54am
chaiein1.8K
Edited 9-May-12 1:57am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

change

from
if(textmessage=="PLAY")

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


(or use a CString).
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 9 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100