如何比较以下代码的字符串? [英] How to Comparing the string for the below code?
本文介绍了如何比较以下代码的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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");
}
我虽然没有进入"PLAY",但我没有进入;
如何精确地比较这一点.我是新手,将这种情况用于WM_COMMAND和sendMessage
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
推荐答案
change
来自
change
from
if(textmessage=="PLAY")
到
to
if( strncmp(textmessage, "PLAY", 4) == 0 )
(或使用CString
).
(or use a CString
).
这篇关于如何比较以下代码的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文