Link to home
Start Free TrialLog in
Avatar of BigRat
BigRatFlag for France

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_activePrinter(BSTR *pVal)
{
      // ZU ERLEDIGEN: Implementierungscode hier hinzufügen
      return S_OK;
}

STDMETHODIMP CRatPrint::put_activePrinter(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?
SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BigRat

ASKER

That didn't actually help me, since I'm not a C++ programmer. The last ActiveX control I wrote was done entirely in traditional C.

I need
1) to delcare a private member string (Unicode!)
2) assign it from a BSTR
3) assign a BSTR from it.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BigRat

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.