| Using the easyConverter Objects |
All of BCL's COM Objects can be accessed from a variety of programming environments. This section shows the basics of COM Objects and how to access them. If you are already familiar with using COM Objects, skip to Sample Code to get started right away.
This example shows how to access a COM Object from Visual C# and Visual Basic .NET.

| Type
type =
Type.GetTypeFromProgID("EasyConverter.PDF2Word.3"); EasyConverterLib.PDF2Word oConverter = (EasyConverterLib.PDF2Word )Activator.CreateInstance(type); try { oConverter.ConvertToWord(inFile, outFile, null, null, null); } catch(System.Runtime.InteropServices.COMException err) { // ... } finally { oConverter = null; } |
| Dim
oConverter As EasyConverterLib.PDF2Word Try oConverter = CreateObject("EasyConverter.PDF2Word.3") Call oConverter.ConvertToWord(inFileName, outFileName) Catch ex As System.Runtime.InteropServices.COMException ' ... End Try |
This example shows how to access a COM Object from Visual Basic.

| Sub
Convert(inFileName As String, outFileName As String) Dim oConverter As EasyConverterLib.PDF2Word On Error GoTo Convert_Error Set oConverter = CreateObject("EasyConverter.PDF2Word.3") Call oConverter.ConvertToWord(inFileName, outFileName) Exit Sub Convert_Error: ' ... End Sub |
This example shows how to access a COM Object from Visual C++.
| #import "C:\Program Files\BCL Technologies\easyConverter SDK\beconv.dll" |
| HRESULT
hr = CoInitialize(NULL); if(FAILED(hr)) { // failed. // ... } |
| EasyConverterLib::IPDF2WordPtr
pConvObj = NULL; try { pConvObj.CreateInstance ("EasyConverter.PDF2Word.3") pConvObj->ConvertToWord(lpInFileName, lpOutFileName); } catch(_com_error &e) { // ... } |
| //
IMPORTANT: // Make sure to free all COM objects before calling // CoUninitialize(), or you'll get an exception. pConvObj = NULL; CoUninitialize(); |