GetApplicationPath

#include “BlackIceDEVMODE.h”

 

LPCTSTR     GetApplicationPath(BlackIceDEVMODE* pDevMode);

Description

Returns the value of the ApplicationPath member of the BlackIceDEVMODE. Represents the value of the 'Output Directory' edit box.

Parameters

BlackIceDEVMODE* pDevMode               - pointer to the BlackIceDEVMODE structure

Return value

Return value - Application Path (string)

Programming Notes

None

Code Example

 

C# example

 

Please see the following example for IMPORTING the BlackIceDEVMODE.dll functions in C# code:

 

[DllImport("BlackIceDEVMODE.dll"EntryPoint = "LoadBlackIceDEVMODE"CharSet = CharSet.Unicode)]

private static extern IntPtr LoadBlackIceDEVMODE(string Printer);

 

[DllImport("BlackIceDEVMODE.dll", EntryPoint = "GetApplicationPath", CharSet = CharSet.Unicode)]

private static extern IntPtr GetApplicationPath(IntPtr lDevmode);

 

               

[DllImport("BlackIceDEVMODE.dll"EntryPoint = "ReleaseBlackIceDEVMODE"CharSet = CharSet.Unicode)]

private static extern bool ReleaseBlackIceDEVMODE(IntPtr  Devmode);

 

Once imported, one can use the GetApplicationPath function in the C# code as in the following example:

 

//Load BlackIceDEVMODE

IntPtr Devmode = LoadBlackIceDEVMODE("Printer Name");

//Pointer to the BlackIceDEVMODE structure or NULL if loading the DEVMODE has failed.

 

//Call the GetApplicationPath function

IntPtr ipApplicationPath = GetApplicationPath(Devmode);

 

//Get the Application Path back from unmanaged memory

string sApplicationPath = Marshal.PtrToStringUni(ipApplicationPath);

 

//Release BlackIceDEVMODE

ReleaseBlackIceDEVMODE(Devmode);

 

VB.NET example

 

Please see the following example for IMPORTING the BlackIceDEVMODE.dll functions in VB.NET code:

 

Private Declare Unicode Function LoadBlackIceDEVMODE Lib "BlackIceDEVMODE.dll" (ByVal sPrinter As String) As IntPtr

      

Private Declare Unicode Function GetApplicationPath Lib "BlackIceDEVMODE.dll" (ByVal pHandle As IntPtr) As IntPtr

      

Private Declare Unicode Function ReleaseBlackIceDEVMODE Lib "BlackIceDEVMODE.dll" (ByVal pHandle As IntPtr) As Boolean

 

Once imported, one can use the GetApplicationPath function in the VB.NET code as in the following example:

 

//Load BlackIceDEVMODE

Dim Devmode As IntPtr

Devmode = LoadBlackIceDEVMODE("Printer Name")

//Pointer to the BlackIceDEVMODE structure or NULL if loading the DEVMODE has failed.

 

//Call the GetApplicationPath function

Dim ipApplicationPath As IntPtr

ipApplicationPath = GetApplicationPath(Devmode)

 

//Get the Application Path back from unmanaged memory

Dim sApplicationPath As String

sApplicationPath = Marshal.PtrToStringUni(ipApplicationPath)

 

//Release BlackIceDEVMODE

ReleaseBlackIceDEVMODE(Devmode)