Specifying a Serial Number in C++

Technical Articles

If you are not using the TX Text Control with Visual Basic you may have to set the license information for the control from your application. This is necessary for distributing your application correctly. Otherwise, you will have the problem that the dialog with the trial version information will be displayed all the time on the end users machine.

Visual C++ is one of the development systems that does not support the licensing model of Visual Basic.

Adding Code to the WM_CREATE Handler

To ensure a correct license for your application you must set the serial information prior any other call to the TX Text Control. Take a look of the following code snippet from the WM_CREATE handler of a Visual C++ sample application:

   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);
   if (!bSuccess)
      return 0;

The license string must be a valid Text Control serial number. Replace the example string "TS-1234567890" with your serial number.

Note: If you are using the trial version of TX Text Control, you do not have any license information. Please call the Create method with an empty string for the serial number.