giuseppe500

hello.
I try to create an activex custom control in mfc,i add a stok property caption and compile.
The library was create , and i use the control on a dialog ,ok work,but if i set the caption from .rc file dont work:
CONTROL "xxxxxxx",IDC_BUTTONPROVACTRL1,
"{AD9B2B86-C0CF-4E44-B50C-C574D6FF8835}",WS_TABSTOP,75,
18,60,25

i compile,but the caption property is inalterate!
why
I look at the stok properties and there is a caption property and a text property that do the same work and there isn't the all the properties of mfc button es: bitmap.


Re: Visual C++ General custom control and .rc

Sdi

The 'text' field is used for standard windows controls to tell the dialog manager to send the control a WM_SETTEXT message with the specified string; that operation is probably not meangingful for your control.



Re: Visual C++ General custom control and .rc

giuseppe500

CONTROL "testo",IDC_CONTROLLOCTRL2,
"{EC750012-90B9-4E0C-ACDA-0B49A21112FC}","WM_SETTEXT "testo",WS_TABSTOP,191,
146,60,25

i try to use WM_SETTEXT "somexxx" but dont work,how i use it
Dont work also use microsoft form 2.0 command button,if i add it:
CONTROL "testo",IDC_CONTROLLOCTRL2,
"{EC750012-90B9-4E0C-ACDA-0B49A21112FC}",WS_TABSTOP,191,
146,60,25

the "testo" field not change the default caption property of microsoft form 2.0 command button.

maybe must change the guid to a strong name some this
PUSHBUTTON "dsa",IDC_CONTROLLOCTRL1,148,29,60,25
this work !
the caption is set to dsa and there aren't guid.
thanks




Re: Visual C++ General custom control and .rc

giuseppe500

Sdi wrote:
The 'text' field is used for standard windows controls to tell the dialog manager to send the control a WM_SETTEXT message with the specified string; that operation is probably not meangingful for your control.

I try to add text property in my control and in the messagemap i add ON_MESSAGE(WM_SETTEXT, OnSetTextaa)
the OnSetText function is this:

LRESULT CpulsanteCtrl:SurprisenSetTextaa(WPARAM wParam, LPARAM lParam)
{

this-SetText("pippo");
return 0;
}

but not set the text and go overflow why
also other property if tested with the debug tool not changed!!!!
ad es:
this->SetBackColor(RGB(110,110,110));
dont work
thanks.




Re: Visual C++ General custom control and .rc

giuseppe500

no , i try to insert the name of ctrl control class:
CONTROL "22222222",IDC_PULSCTRL1,"CpulsCtrl",WS_TABSTOP,137,97,
60,25

and the "22222222" appare in the caption property and viceversa.
ok!
but the graphics of the control(an button activex)is not correct.




Re: Visual C++ General custom control and .rc

Sdi

I'd guess that your control doesn't use WM_SETTEXT to set the text that appears on the button; you know your control much better than I.



Re: Visual C++ General custom control and .rc

giuseppe500

sorry sdi but i try whith spy++ how kind of message will send to the control when i change manually the .rc and compile, but i not find the message .
the settext is correct only for the designe time,but not for the "compiled resorce"(manually .rc file changes).
The problem maybe the container is possible that the .rc compiled send message to the container and not to the activex
tanks




Re: Visual C++ General custom control and .rc

Sdi

That's what I said: "...WM_SETTEXT message with the specified string; that operation is probably not meangingful for your control". If the behavior of the control is to set the button text some other way, then the text specified in the .RC file is meaningless.



Re: Visual C++ General custom control and .rc

giuseppe500

sdi , i use your method(sorry but is 2 month that programming in c++)and the problem is not on the settext but in the gettext , this is sme of my code:
BEGIN_MESSAGE_MAP(CDefBtnCtrl, COleControl)
//{{AFX_MSG_MAP(CDefBtnCtrl)
//}}AFX_MSG_MAP
ON_MESSAGE(OCM_COMMAND, OnOcmCommand)
ON_MESSAGE(WM_SETTEXT , SetText)
ON_MESSAGE(WM_GETTEXT , GetText)
ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
END_MESSAGE_MAP()


and this is the methods:
LRESULT CDefBtnCtrl:Tongue TiedetText(WPARAM wParam, LPARAM lParam)
{
AfxMessageBox("work");
// TODO: Switch on wNotifyCode here.
OnSetText(wParam,lParam);
return 1;
}
LRESULT CDefBtnCtrl::GetText(WPARAM wParam, LPARAM lParam)
{
AfxMessageBox("work");
.

return 1;
}
notify the that the text is changed
void CDefBtnCtrl:SurprisenTextChanged()
{
AfxMessageBox("pippo");


}
work , but in the dialog if i change the .rc file and set a new caption the settext and the gettext with the afxmessageboxes dont start , but the notify pippo of the ontextchanged start.




Re: Visual C++ General custom control and .rc

giuseppe500

nobody