求急救。。。关于函数调用问题
BOOL CDlgChangePwd::OnInitDialog()
{
CBaseDialog::OnInitDialog();
ShowButton('D', "确认");
ShowButton('H', "其它服务");
//获取验证码按钮
m_btI = new CButtonST();
m_btI->Create("获取校验码",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(0,0,0,0), this, NULL);
m_btI->MoveWindow(690,635,250,60);
m_btI->ShowWindow(TRUE);
return TRUE;
}
void CDlgChangePwd::OnPaint()
{
// 旧密码
pointf.X = float(gintScreemCX * 0.17);
Color color1(255,0,0,0); //密码框内字体颜色
Font font5(L"Arial", (float)(gintScreemCX * 0.025),FontStyleBold);
pointf.Y = float(gintScreemCY * 0.42);
CString strShow1="",strShow2="",strShow3="",strShow4="";
//*****************************************
// 校验码
pointf.Y = float(gintScreemCY * 0.72);
if (m_strInput.GetLength()>0)
ShowText(&dc,
strShow4,
font5,
pointf,
color1,
StringAlignmentNear);
}
代码如上说述
请教各位大虾我想在OnInitDialog() 函数中调用(提取)到strShow4中的类容 怎样才能做到??
[解决办法]
你的strShow4是一个局部变量,在OnPaint中定义的.
要想得到就只有保存成成员变量或者全局变量中.
但是有有另外一个问题,在你调用OnInitDialog的时候,OnPaint还没有调用,你去哪里得到你的strShow4的内容.