i did 1 code for give me the menu position. but i'm getting problems compare the LPSTR or LPCSTR with string :(
int GetMenuPosition(HMENU menu, string caption)
{
int i=0;
for(i=0; i<GetMenuItemCount(menu)-1;i++)
{
MENUITEMINFO s= {0};
s.cbSize=sizeof(MENUITEMINFO );
s.fMask=MIIM_STRING;
s.cch=strlen(strCaption.c_str());
//s.dwTypeData=(LPSTR)strCaption.c_str();
GetMenuItemInfo (menu,i, true, &s);
string b=static_cast<char*>(s.dwTypeData);
if(b==caption)
break;
}
MessageBox(NULL,to_string(i).c_str(),"menuposition", MB_OK);
return i;
}
can anyone explain to me?