TX Text Control ActiveX

Specifying a Serial Number in C++

Topic

If you use TX Text Control ActiveX in a development system other than Visual Basic, you may have to set the license information for the control from your application. Visual C++ is one of the development systems that don't support the licensing model of Visual Basic.

Warning

Missing License Information. Without the license information, your application isn't distributed correctly: the dialog box with the trial version information is displayed on the end user's machine all the time.

The TX Text Control Trial Version dialog box of TX Text Control ActiveX 34.0 SP5, which says that a nag screen appears every time the program starts and every fifteen minutes.

Pass the Serial Number When the Control Is Created

Set the serial number before any other call to TX Text Control. The following code comes from the WM_CREATE handler of a Visual C++ sample application, which creates the control and passes the serial number as its last parameter:

...
if (CWnd::Create(lpszClassName, lpszWindowName, dwStyle,rect,
   pParentWnd, nID, pContext) == 0)
   return 0;
WCHAR szLic[] = L"TS-1234567890";
BSTR bstrKey = SysAllocString(szLic);
BOOL bSuccess = m_txctrl.Create(NULL, dwStyle, rect,
   this, 1000, NULL, NULL,bstrKey);
SysFreeString(bstrKey);
if (!bSuccess)
   return 0;
...

The code works as follows:

  • szLic holds the license string. It must be a valid Text Control serial number: replace the example string "TS-1234567890" with yours.
  • SysAllocString turns the string into the BSTR that Create expects, and SysFreeString releases it after the call.
  • m_txctrl.Create creates the control with the serial number in its last parameter. The handler returns 0 when the window or the control can't be created.

Use the Trial Version

The trial version of TX Text Control has no license information. Call the Create method with an empty string for the serial number.