Click here to Skip to main content
15,885,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all!
i have created a button control activeX MFC, and created property 'Text' , it same 'caption' of basic button.
however, after i compile, use on VB.net, that ok. But C++ application MFC, caption not change now, but when i move it on design dialog, it changed.
i do not understand it.
plz help me !!!
i debug with tstcont.exe, apss form (VB.net), C++ MFC (: error)
what solution for it!
thanks so much!!!

C++
BSTR CButtonViewCtrl::GetTex(void)
{
     AFX_MANAGA_STATE(AfxGetStaticModuleState());
     CString strResult;
     _buttonView.GetWindowText(strResult);
    return strResult.AllocSysString();
}

voidCButtonViewCtrl::SetTex(LPCTSTR newVal)
{
     AFX_MANAGA_STATE(AfxGetStaticModuleState());
     _buttonView.SetWindowText(newVal);
    SetModifiedFlag();
}


it's difficult to know, so code is normal
it's worked normal on VB.net/ testContainer,apps win form...
but, on application MFC... it will be change caption when we move button on design dialog
again >"<</xml>
Posted
Updated 21-Apr-13 23:51pm
v2
Comments
Leo Chapiro 22-Apr-13 4:41am    
Nobody can help without to see your source code - please show what you have tried as far ...
dev C plus 22-Apr-13 5:26am    
code is normal!
i also only do not understand, why is not working now with application MFC, while it's good with vb.net and test container

BSTR CButtonViewCtrl::GetTex(void)
{
AFX_MANAGA_STATE(AfxGetStaticModuleState());
CString strResult;
_buttonView.GetWindowText(strResult);
return strResult.AllocSysString();
}

voidCButtonViewCtrl::SetTex(LPCTSTR newVal)
{
AFX_MANAGA_STATE(AfxGetStaticModuleState());
_buttonView.SetWindowText(newVal);
SetModifiedFlag();
}
P Uday kishore 22-Apr-13 7:03am    
try using updatedata(true) once...
dev C plus 22-Apr-13 21:04pm    
yes! i have try it with that solution.
thanks so much. but is no working!
ex:
voidCButtonViewCtrl::SetTex(LPCTSTR newVal)
{
AFX_MANAGA_STATE(AfxGetStaticModuleState());
updatedata();
_buttonView.SetWindowText(newVal);
updatedata(FALSE); // i have try it with updatedata(TRUE)
SetModifiedFlag();
}
P Uday kishore 23-Apr-13 0:09am    
invalidate()....

1 solution

use different texts so you will see, that you see a different text value than, you want to see.

Check that you are using the right handle. Check the result and read the docs:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx[^]
 
Share this answer
 
Comments
dev C plus 22-Apr-13 5:30am    
thanks you for this!
i have review on msdn and many forum... so much
so, i try it with more solution and bug is not yet fix
KarstenK 22-Apr-13 5:58am    
seperate the "layers" ie objects and code segments til you get a working skeleton. On that way you will find your bug.

https://en.wikipedia.org/wiki/File:H96566k.jpg

;-)
dev C plus 23-Apr-13 0:18am    
oh! thanks for it
But, this a same code normal, and the problem is difficult to understand
now, i'm not yet fix it
is bored
KarstenK 23-Apr-13 3:13am    
I am convinced that you have 2 or more texts, which are overlapping. So I use the keyword "layer". You need to fizzle it in separete parts....
dev C plus 23-Apr-13 3:58am    
i don't think same to you
because, my project is started and i only had a object button inherit Class CButton
just, i have created one variable _mButton, and one property for it
so... to change Caption for it, i use API Get/SetWindowText() for function Get/Set
if any thing as you talk about with me... also, on vb.net, test container, it can't compile good also as now
thanks for help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900