The GetLastErrorMsg method returns the error message generated by the last call to a CDIntf function call.
System.String GetLastErrorMsg()
void GetLastErrorMsg(LPSTR Msg, long MaxMsg)
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.
This method returns a description of the last error generated by a call to a CDIntf function.
Member of CDIntfEx.CDIntfEx.
Public Sub GetLastErrorMsg()
' Constants for Activation codes
Const strLicenseTo As String = "DOCX Converter Developer Evaluation"
Const strActivationCode As String = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
Const AMYUNIPRINTERNAME As String = "ERROR"
' Declare a new cdintfex object if it does not exist in the form.
Dim DOCX As New CDIntfEx.CDIntfEx
' We have forced an error with the printer‘s name
Try
DOCX.DriverInit(AMYUNIPRINTERNAME)
Catch
' Print the last error message generated
MsgBox(DOCX.GetLastErrorMsg)
End Try
End Sub
public void GetLastErrorMsg()
{
// Constants for Activation codes
const string strLicenseTo = "DOCX Converter Developer Evaluation";
const string strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";
const string AMYUNIPRINTERNAME = "ERROR";
// Declare a new cdintfex object if it does not exist in the form.
CDIntfEx.CDIntfEx DOCX = new CDIntfEx.CDIntfEx();
// We have forced an error with the printer' s name
try
{
DOCX.DriverInit(AMYUNIPRINTERNAME);
}
catch
{
// Print the last error message generated
MessageBox.Show(DOCX.GetLastErrorMsg());
}
}
// DOCX 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 "DOCX Converter Developer Evaluation"
#define strActivationCode "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
#define AMYUNIPRINTERNAME "ERROR"
try
{
// We have forced an error with the printer' s name
HANDLE DOCX = 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 = "DOCX Converter Developer Evaluation";
String strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";
String AMYUNIPRINTERNAME = "ERROR";
// Declare a new cdintfex object if it does not exist in the form.
ActiveXComponent docx = new ActiveXComponent("CDIntfEx.CDIntfEx.6.5");
try
{
// We have forced an error with the printer' s name
Dispatch.call(docx,"DriverInit",AMYUNIPRINTERNAME);
}
catch(Exception e)
{
Variant message = Dispatch.call(docx,"GetLastErrorMsg");
System.out.println(message);
}
}
}
# Constants for Activation codes
$strLicenseTo = "DOCX Converter Developer Evaluation"
$strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
$AMYUNIPRINTERNAME = "ERROR"
#Declare a new cdintfex object if it does not exist in the form.
$DOCX = New-Object -ComObject CDIntfEx.CDIntfEx.6.5
try
{
#We have forced an error with the printer' s name
[System.__ComObject].InvokeMember('DriverInit', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,$AMYUNIPRINTERNAME)
}
catch
{
#Print the last error message generated
[System.__ComObject].InvokeMember('GetLastErrorMsg', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,$null)
}
' Constants for Activation codes
Const strLicenseTo = "DOCX Converter Developer Evaluation"
Const strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"
Const AMYUNIPRINTERNAME = "ERROR"
' Declare a new cdintfex object
Dim DOCX
Set DOCX = CreateObject("CDIntfEx.CDIntfEx.6.5")
On Error Resume Next
' We have forced an error with the printer' s name
DOCX.DriverInit AMYUNIPRINTERNAME
' Print the last error message generated
WScript.Echo(DOCX.GetLastErrorMsg)
' Destroy DOCX object
Set DOCX = Nothing