GetLastErrorMsg

The GetLastErrorMsg method returns the error message generated by the last call to a CDIntf function call.

 

Syntax

ActiveX:

System.String GetLastErrorMsg()

DLL:

void GetLastErrorMsg(LPSTR Msg, long MaxMsg)

 

Parameters

Msg

[out] Address of buffer that will contain the error message.

MaxMsg

Size of the Msg buffer. The error message will be truncated if it is larger than the input buffer.

 

Return Value

This method returns a description of the last error generated by a call to a CDIntf function.

 

 

Member of CDIntfEx.CDIntfEx.

 

Example

Public Sub GetLastErrorMsg()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"

    Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    Const AMYUNIPRINTERNAME As String = "ERROR"

 

    ' Declare a new cdintfex object if it does not exist in the form.

    Dim PDF As New CDIntfEx.CDIntfEx

 

    ' We ha’ve forced an error with the printer‘s name        

    Try

        PDF.DriverInit(AMYUNIPRINTERNAME)

    Catch

        ' Print the last error message generated

        MsgBox(PDF.GetLastErrorMsg)

    End Try

End Sub

public void GetLastErrorMsg()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Converter Evaluation";

    const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

    const string AMYUNIPRINTERNAME = "ERROR";

 

    // Declare a new cdintfex object if it does not exist in the form.

    CDIntfEx.CDIntfEx PDF = new CDIntfEx.CDIntfEx();

 

    // We ha’ve forced an error with the printer' s name        

    try

    {

        PDF.DriverInit(AMYUNIPRINTERNAME);

    }

    catch

    {

        // Print the last error message generated

        MessageBox.Show(PDF.GetLastErrorMsg());

    }

}

// PDF Converter Cpp.cpp : Defines the entry point for the console application.

// 

#include <Windows.h>

#include <string>

#include <iostream>

#include "CdIntf.h"

#pragma comment (lib, "CDIntf.lib")

 

using namespace std;

int main()

{

     // Constants for Activation codes

    #define strLicenseTo  "Amyuni PDF Converter Evaluation"

    #define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

    #define AMYUNIPRINTERNAME "ERROR"

 

    try

    {

        // We ha’ve forced an error with the printer' s name        

        HANDLE PDF = DriverInit(AMYUNIPRINTERNAME);

    }

    catch (int e)

    {

        // Print the last error message generated

        char error[256];

        GetLastErrorMsg(error, sizeof(error));

        MessageBox(NULL, (LPCWSTR)error, (LPCWSTR)"Printer Error", MB_OK | MB_ICONWARNING );

    }

    return 0;

}

package Example;

 

import com.jacob.activeX.ActiveXComponent;

import com.jacob.com.Dispatch;

import com.jacob.com.Variant;

 

public class GetLastErrorMsg {

    public static void main(String[] args)

    {

        // Constants for Activation codes

        String strLicenseTo  = "Amyuni PDF Converter Evaluation";

        String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";

        String AMYUNIPRINTERNAME = "ERROR";

 

        // Declare a new cdintfex object if it does not exist in the form.

        ActiveXComponent pdf = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5"); 

 

        try

        {

            // We ha’ve forced an error with the printer' s name        

            Dispatch.call(pdf,"DriverInit",AMYUNIPRINTERNAME);

        }

        catch (Exception e)

        {

            Variant message = Dispatch.call(pdf,"GetLastErrorMsg");

            System.out.println(message);

        }

 

    }

}

# Constants for Activation codes

$strLicenseTo  =  "Amyuni PDF Converter Evaluation"

$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

$AMYUNIPRINTERNAME = "ERROR"

 

#Declare a new cdintfex object if it does not exist in the form.

$PDF = New-Object -ComObject CDIntfEx.CDIntfEx.6.5

 

try

{

    #We ha’ve forced an error with the printer' s name        

    [System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$AMYUNIPRINTERNAME) 

}

catch

    #Print the last error message generated

    [System.__ComObject].InvokeMember('GetLastErrorMsg', [System.Reflection.BindingFlags]::InvokeMethod,$null,$PDF,$null) 

}

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Converter Evaluation"

Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"

Const AMYUNIPRINTERNAME = "ERROR"

 

' Declare a new cdintfex object

Dim PDF

Set PDF = CreateObject("CDIntfEx.CDIntfEx.6.5")

 

On Error Resume Next

 

' We ha’ve forced an error with the printer' s name        

PDF.DriverInit AMYUNIPRINTERNAME

 

' Print the last error message generated

WScript.Echo(PDF.GetLastErrorMsg)

 

' Destroy PDF object

Set PDF = Nothing