Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my activex doesn't work fine in a web page

Status
Not open for further replies.

davinia1

Programmer
Jul 2, 2004
12
ES
Hi,
I really need help :( . I would be very grateful.
I've made an activex control (using mfc)

It appears in my the web page but it seems that I don't set the property properly because mymethod has a MessageBox to show the value of the variable and it appears nothing in it (although it works fine in the test container)

<HTML>
<BODY>
<OBJECT ID=myactivex CLASSID="clsid:835373ED-FB5F-4EB5-84B1-28E1B30AA231" WIDTH=300 HEIGHT=200 BORDER=1 HSPACE=5>
<PARAM NAME="mymessage" VALUE="hello">
</OBJECT>

<INPUT TYPE="button" VALUE="mybutton" onClick="myactivex.mymethod()"><BR>
<BODY>
</HTML>

I haven't found a tutorial of activex and mfc, so I don't know if what I've done it's correct.

To set the property "mymessage", I've selected "Add Property" and I've set:
External name: mymessage
Type: BSTR
having selected Get/Set methods

and I've created m_mymessage as a member variable

So, I have:
BSTR CPru1Ctrl::GetMymessage()
{
CString strResult;
strResult = m_mymessage; //I've added this
return strResult.AllocSysString();
}

void CPru1Ctrl::SetMymessage(LPCTSTR lpszNewValue)
{
m_mymessage = lpszNewValue; //I've added this
SetModifiedFlag();
}

void CPru1Ctrl::mymethod()
{
MessageBox(m_mymessage, "value of mymessage", MB_OK);
}

Thanks in advance.
 
Did you create a corresponding Property Exchanger (PX) in your DoPropExchange(CPropExchange* pPX)?

Like this:

PX_String(pPX, _T("mymessage"), m_mymessage);

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top