BigRat
asked on
CString in ActiveX Control
I'm using VC++ 6.0 and am writing an ActiveX control (in a dll) which the Wizard has produce 90% of the code so far.
I have to remember an "active printer" with these two property functions :-
STDMETHODIMP CRatPrint::get_activePrint er(BSTR *pVal)
{
// ZU ERLEDIGEN: Implementierungscode hier hinzufügen
return S_OK;
}
STDMETHODIMP CRatPrint::put_activePrint er(BSTR newVal)
{
// ZU ERLEDIGEN: Implementierungscode hier hinzufügen
return S_OK;
}
but if I declare a private member variable in my CRatPrint class, viz :
CString m_activePrinter;
I get an "CString not declared" error although I've included stdafx and windows.h.
What is really the best way of storing a string in an ActiveX control? And if it is CString what am I doing wrong?
I have to remember an "active printer" with these two property functions :-
STDMETHODIMP CRatPrint::get_activePrint
{
// ZU ERLEDIGEN: Implementierungscode hier hinzufügen
return S_OK;
}
STDMETHODIMP CRatPrint::put_activePrint
{
// ZU ERLEDIGEN: Implementierungscode hier hinzufügen
return S_OK;
}
but if I declare a private member variable in my CRatPrint class, viz :
CString m_activePrinter;
I get an "CString not declared" error although I've included stdafx and windows.h.
What is really the best way of storing a string in an ActiveX control? And if it is CString what am I doing wrong?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mrblue, I tried that as well, but I kept getting "not declared errors". I just can't get all these silly include files right.
I have simply done it using the SysString API. Free the old string if allocated and copy the new one.
I have simply done it using the SysString API. Free the old string if allocated and copy the new one.
ASKER
I need
1) to delcare a private member string (Unicode!)
2) assign it from a BSTR
3) assign a BSTR from it.