GetVersionInformation

The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files.

 

Syntax

ActiveX:

System.Int32 GetVersionInformation([out] System.Int32 CDIntfMajor, [out] System.Int32  CDIntfMinor, [out] System.Int32  PrinterDriverMajor, [out] System.Int32  PrinterDriverMinor)

DLL:

long GetVersionInformation(HANDLE hIntf, [out] long *CDIntfMajor, [out] long *CDIntfMinor, [out] long *PrinterDriverMajor, [out] long *PrinterDriverMinor)

 

Parameters

CDIntfMajor

Will contain the cdintf.dll major version.

CDIntfMinor

Will contain the cdintf.dll minor version.

PrinterDriverMajor

Will contain the printer driver major version.

PrinterDriverMinor

Will contain the printer driver minor version.

hIntf

Handle to printer returned by any of the DriverInit function calls.  

 

Return Value

It returns 0 if successful.

 

Remarks

Member of CDIntfEx.CDIntfEx.

Example

Sub Sample()

        ' Constants for Activation codes

        Const strLicenseTo As String = "DOCX Converter Developer Evaluation"

        Const strActivationCode As String = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

        Const AMYUNIPRINTERNAME As String = "Amyuni DOCX Converter"

 

        ' Constants

        Const NoPrompt As Int32 = &H1  ' do not prompt for file name

 

        ' Declare a new cdintfex object if it doesn't exist in the form.

        Dim DOCX As New CDIntfEx.CDIntfEx

 

        ' Get a reference to the installed printer.

        ' This will fail if the printer name passed to the DriverInit method is 

        ' not found in the printer’s folder

        DOCX.DriverInit(AMYUNIPRINTERNAME)

 

        ' The SetDefaultPrinter function sets the system default printer to the one

        ' initialized by the DriverInit functions.

        DOCX.SetDefaultPrinter()

 

        ' The EnablePrinter() method needs to be called right before each print job. 

        ' Calling the EnablePrinter() method will start a 20 second time-out value

        DOCX.EnablePrinter(strLicenseTo, strActivationCode)

 

        ' The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files

        Dim CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor As Integer

        DOCX.GetVersionInformation(CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor)

        MsgBox("Version cdintf.dll: " + HIWORD(CDIntfMajor)+ "." + LOWORD(CDIntfMajor)+ "." + HIWORD(CDIntfMinor)+ "." + LOWORD(CDIntfMinor))

        MsgBox("Version Printer Driver: " + HIWORD(PrinterDriverMajor)+ "." + LOWORD(PrinterDriverMajor)+ "." + HIWORD(PrinterDriverMinor)+ "." + LOWORD(PrinterDriverMinor))

 

        ' The RestoreDefaultPrinter function resets the system default printer 

        ' to the printer that was the default before the call to SetDefaultPrinter.

        DOCX.RestoreDefaultPrinter()

 

        ' Close Printer

        DOCX.DriverEnd()

 

        ' Destroy DOCX object

        DOCX = Nothing        

    End Sub

 

    Function HIWORD(lparam As Long) As String

        ' This is the HIWORD of the lParam:

        Return(lparam \ &H10000 And &HFFFF&).ToString

    End Function

 

    Function LOWORD(lparam As Long) As String

        ' LOWORD now equals 65,535 or &HFFFF

        Return(lparam And &HFFFF&).ToString

    End Function

 

End Module

static void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "DOCX Converter Developer Evaluation";

    const string strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190";

    const string AMYUNIPRINTERNAME = "Amyuni DOCX Converter";

 

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

    CDIntfEx.CDIntfEx DOCX = new CDIntfEx.CDIntfEx();

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    DOCX.DriverInit(AMYUNIPRINTERNAME);

 

    // The SetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    DOCX.SetDefaultPrinter();

 

    // The EnablePrinter() method needs to be called right before each print job. 

    // Calling the EnablePrinter() method will start a 20 second time-out value

    DOCX.EnablePrinter(strLicenseTo, strActivationCode);

 

    // The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files

    Int32 CDIntfMajor = 0;

    Int32 CDIntfMinor = 0;

    Int32 PrinterDriverMajor = 0;

    Int32 PrinterDriverMinor = 0;

    DOCX.GetVersionInformation(ref CDIntfMajor, ref CDIntfMinor, ref PrinterDriverMajor, ref PrinterDriverMinor);

    Console.WriteLine("Version cdintf.dll: " + HIWORD(CDIntfMajor)+ "." + LOWORD(CDIntfMajor)+ "." + HIWORD(CDIntfMinor)+ "." + LOWORD(CDIntfMinor));

    Console.WriteLine("Version Printer Driver: " + HIWORD(PrinterDriverMajor)+ "." + LOWORD(PrinterDriverMajor)+ "." + HIWORD(PrinterDriverMinor)+ "." + LOWORD(PrinterDriverMinor));

 

    // The RestoreDefaultPrinter function resets the system default printer 

    // to the printer that was the default before the call to SetDefaultPrinter.

    DOCX.RestoreDefaultPrinter();

 

    // This function will simply detach from an existing printer because the handle was created using DriverInit

    DOCX.DriverEnd();

 

    // Destroy DOCX object

    DOCX = null;    

}

 

static string HIWORD(long lparam)

{

// This is the HIWORD of the lParam:

    System.Int16 y = BitConverter.ToInt16(BitConverter.GetBytes(lparam), 2);

    return y.ToString();

}

 

static string LOWORD(long lparam)

{

    // This is the HIWORD of the lParam:

    System.Int16 y = BitConverter.ToInt16(BitConverter.GetBytes(lparam), 0);

    return y.ToString();

}

// 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 AMYUNI_PRINTER_NAME "Amyuni DOCX Converter"

 

    // Get a reference to the installed printer.

    // This will fail if the printer name passed to the DriverInit method is 

    // not found in the printer’s folder

    HANDLE DOCX = DriverInit(AMYUNI_PRINTER_NAME);

 

    // The CDISetDefaultPrinter function sets the system default printer to the one

    // initialized by the DriverInit functions.

    CDISetDefaultPrinter(DOCX);

 

    // The EnablePrinter() method needs to be called right before each print job.

    // Calling the EnablePrinter() method will start a 20 second time-out value

    EnablePrinter(DOCX, strLicenseTo, strActivationCode);

 

    // The GetVersionInformation method reports major and minor version of cdintf dll and printer driver files

    long CDIntfMajor, CDIntfMinor, PrinterDriverMajor, PrinterDriverMinor;

    GetVersionInformation(DOCX, &CDIntfMajor, &CDIntfMinor, &PrinterDriverMajor, &PrinterDriverMinor);

 

    cout << "Version cdintf.dll: " << HIWORD(CDIntfMajor)<< "." << LOWORD(CDIntfMajor)<< "." << HIWORD(CDIntfMinor)<< "." << LOWORD(CDIntfMinor)<< endl;

    cout << "Version Printer Driver: " << HIWORD(PrinterDriverMajor)<< "." << LOWORD(PrinterDriverMajor)<< "." << HIWORD(PrinterDriverMinor)<< "." << LOWORD(PrinterDriverMinor)<< endl;

 

    // The RestoreDefaultPrinter function resets the system default printer

    // to the printer that was the default before the call to SetDefaultPrinter.

    RestoreDefaultPrinter(DOCX);

 

    // Close Printer

    DriverEnd(DOCX);

 

    // Destroy DOCX object

    DOCX = NULL;    

 

    return 0;

}

function HIWORD

{

    [bitconverter]::ToInt16([bitconverter]::GetBytes($args[0]),2)

}

 

function LOWORD

{

    [bitconverter]::ToInt16([bitconverter]::GetBytes($args[0]),0)

}

 

 

# Constants for Activation codes

$strLicenseTo  =  "DOCX Converter Developer Evaluation"

$strActivationCode = "07EFCDAB010001002EE718DAABD90353AA8141F60B6762C695F4D5BA97F516CBE3EB407DC717EC1D28DE39A61F1ACE26924C99AFB190"

$AMYUNIPRINTERNAME = "Amyuni DOCX Converter"

 

#Declare a new cdintfex object if it doesn't exist in the form.

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

 

#The function will first attempt to connect to an existing printer. 

#If it does not find any printer with the name provided by PrinterName, 

#it will attempt to install a new printer.

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

 

#The SetDefaultPrinter function sets the system default printer to the one

#initialized by the DriverInit functions.

$dummyvar = [System.__ComObject].InvokeMember('SetDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,$null)

 

 

#The EnablePrinter() method needs to be called right before each print job. 

#Calling the EnablePrinter() method will start a 20 second time-out value

$dummyvar = [System.__ComObject].InvokeMember('EnablePrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, @($strLicenseTo, $strActivationCode))

 

#The BatchConvert method converts a number of files to DOCX.

$paramMod = new-object -type System.Reflection.ParameterModifier(4)

$paramMod[0] = $true

$paramMod[1] = $true

$paramMod[2] = $true

$paramMod[3] = $true

 

$CDIntfMajor = 0

$CDIntfMinor = 0

$PrinterDriverMajor = 0

$PrinterDriverMinor = 0

$methodArgs =@($CDIntfMajor, $CDIntfMinor, $PrinterDriverMajor, $PrinterDriverMinor)

$dummyvar = [System.__ComObject].InvokeMember('GetVersionInformation', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX, $methodArgs, $paramMod, $null, $null)

 

echo "Version cdintf.dll:"

echo(HIWORD $methodArgs[0]),(LOWORD $methodArgs[0]),(HIWORD $methodArgs[1]),(LOWORD $methodArgs[1])

 

echo "Version Printer Driver:"

echo(HIWORD $methodArgs[2]),(LOWORD $methodArgs[2]),(HIWORD $methodArgs[3]),(LOWORD $methodArgs[3])

 

#The RestoreDefaultPrinter function resets the system default printer 

#to the printer that was the default before the call to SetDefaultPrinter.

$dummyvar = [System.__ComObject].InvokeMember('RestoreDefaultPrinter', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,$null)

 

#This function will attempt to remove the printer because the handle was created using DOCXDriverInit

$dummyvar = [System.__ComObject].InvokeMember('DriverEnd', [System.Reflection.BindingFlags]::InvokeMethod,$null,$DOCX,$null)

 

#Destroy DOCX object

$DOCX = $null