PDEmailInterface COM Object

The PDEmailInterface COM Object provides an interface allowing Windows applications to detect the presence of Pando and integrate Pando file sending.

Functions

The PDEmailInterface COM object provides the following functions:

SendLink

SendLink is used to have Pando package and upload a set of files. It returns the Pando Package URL, which can be sent by the application to recipients. For example, it can be sent via an instant messaging network. The call returns when Pando packaging is complete, which typically takes several seconds. Uploading will continue asynchronously until complete.


        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SendLink( 
            /* [in] */ ULONG hWndParent,
            /* [in] */ VARIANT *filePaths,
            /* [out] */ BSTR *url) = 0;

The arguments are:

hWndParent
parent window (always passed in COM calls).
filePaths
an array of file paths of the files to package.
url
the Pando Package URL.

SetPluginVersion

SetPluginVersion is called in order to identify the calling application.


        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetPluginVersion( 
            /* [in] */ BSTR name,
            /* [in] */ BSTR version) = 0;

The arguments are:

name
The name of the application.
version
The version of the application.

Examples

Here are examples of using the PDEmailInterface COM object from C++ and Visual Basic. Note that the SendLink method is provided only by pando.PDEmailInterface version 2 or newer. Thus, if "pando.PDEmailInterface.2" cannot be created, either Pando is not installed or it must be upgraded.

C++

{
try {
    CComPtr pando;
    //the create object will fail if Pando is not installed
    if(SUCCEEDED(pando.CoCreateInstance(L"pando.PDEmailInterface.2")) && pando)
    {
        // use this to initialize the dialog with a set of files
        // Create a SAFEARRAY to hold the list of files //
        SAFEARRAY      *pArray;
        SAFEARRAYBOUND bounds;
        bounds.cElements = arrayFilenames.GetSize();
        bounds.lLbound   = 0;
        pArray = SafeArrayCreate(VT_BSTR, 1, &bounds);
        // Initialize the SAFEARRAY with the filenames //
        if(!pArray)
            break;

        for(long ii = 0; ii < arrayFilenames.GetSize(); ii++)
            //arrayFilenames is your array of filenames
            SafeArrayPutElement(pArray, &ii, CComBSTR(arrayFilenames[ii])); 
        VARIANT var;
        VariantInit(&var);
        var.vt = VT_ARRAY | VT_BYREF | VT_BSTR;
        var.pparray = &pArray;
        
        // You MUST set this to a unique value for Your Application
        pando->SetPluginVersion(CComBSTR("MyAppName"), CComBSTR(""));
        CComBSTR url;
        if (SUCCEEDED(pando->SendLink(m_hWnd, &var, &url)) SendLink(m_hWnd, NULL, &url)
        {
           //use the http:// url to the pando file 
           //prepend pando:download? to make it a Pando URL
        }
        VariantClear(&var);// for the file list
    }
}catch(...){}

}

Visual Basic

{
    Dim strPaths(1 To 3) As String
    Dim pandoPath As String
    strPaths(1) = "C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-006.jpg"
    strPaths(2) = "C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-011.jpg"
    strPaths(3) = "C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-018.jpg"
    Dim pds As Object
    Set pds = CreateObject("pando.PDEmailInterface.2")
    Dim strUrl As String
    'You MUST set this to a unique value for Your Application
    pds.SetPluginVersion "MyApplicationName", ""
    pds.SendLink MyForm.hWnd, strPaths, strUrl
    'strUrl is the http path to the .pando file
    'prepend pando:download? to create a Pando URL
    MsgBox strUrl
}

.Net


PDEmailInterface pandoAPI = new PDEmailInterfaceClass();
object strPaths = new string[] {
    @"C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-006.jpg",
    @"C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-011.jpg",
    @"C:\Documents and Settings\Paul\My Documents\My Pictures\dumbo\pod-018.jpg" };
// You MUST set this to a unique value for Your Application
pandoAPI.SetPluginVersion("MyApplicationName", "");
string strUrl;
pandoAPI.SendLink((uint)this.Handle, ref strPaths, out strUrl);
// strUrl is the http path to the .pando file
// prepend pando:download? to create a Pando URL
MessageBox.Show(strUrl);