CString str = _T("Hello World!"); BSTR bstr = str.AllocSysString();
_bstr_t MyString("Hello"); CString MyCString(MyString); BSTR bstr = MyCString.AllocSysString();In this example, a `_bstr_t` object `MyString` is created with the value "Hello". Then, `MyString` is converted to a CString object `MyCString`. Finally, the `AllocSysString()` method is called on `MyCString` which returns a BSTR that is assigned to a variable `bstr`. The package library that contains `CString AllocSysString` is the MFC (Microsoft Foundation Classes) library, which is a part of the Microsoft Visual Studio IDE (Integrated Development Environment).