传值到编辑框,Build出错,是什么问题?
每500ms刷新一次血量;
m_roleblood是编辑框变量,int类型;
Build出错:
error C2228: left of '.SetWindowTextA' must have class/struct/union type
哪里有问题?应该怎么修改?
代码就这个多。
#define BloodBase 0x02F40D28 //玩家血量adress
int m_roleblood;
void CALLBACK RoleBlood(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
{
char s[30];
int * pBlood=(int *)BloodBase;
itoa(* pBlood,s,10);
m_roleblood.SetWindowText(s);
}
const int RoleBloodCheckID=238;
void WGForm::OnRoleblood()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_rolebloodcheck)
{
SetTimer(RoleBloodCheckID,500,&RoleBlood);
}
else
{
KillTimer(RoleBloodCheckID);
}
}
#define BloodBase 0x02F40D28 //玩家血量adress
int m_roleblood;
void CALLBACK RoleBlood(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
{
int * pBlood=(int *)BloodBase;
CString s;
s.Format("%d",*pBlood);
::SetWindowText(hwnd,s);
}
const int RoleBloodCheckID=238;
void WGForm::OnRoleblood()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_rolebloodcheck)
{
SetTimer(RoleBloodCheckID,500,&RoleBlood);
}
else
{
KillTimer(RoleBloodCheckID);
}
}
//MFC
CEdit m_roleblood;
//在映射的地方加上
DDX_Control(pDX, IDC_EDIT/*你的控件ID*/, m_roleblood);
//设置编辑框字符串
m_roleblood.SetWindowText(s);
//或者,你直接使用你m_roleblood赋值
m_roleblood = 100;