Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSysWOW64 on Windows 7 Pin
C#Coudou15-Dec-09 16:55
C#Coudou15-Dec-09 16:55 
AnswerRe: SysWOW64 on Windows 7 Pin
JR21215-Dec-09 22:54
JR21215-Dec-09 22:54 
AnswerRe: SysWOW64 on Windows 7 Pin
Dave Kreskowiak16-Dec-09 2:06
mveDave Kreskowiak16-Dec-09 2:06 
GeneralRe: SysWOW64 on Windows 7 Pin
C#Coudou16-Dec-09 13:35
C#Coudou16-Dec-09 13:35 
QuestionRe: SysWOW64 on Windows 7 Pin
JR21216-Dec-09 22:18
JR21216-Dec-09 22:18 
AnswerRe: SysWOW64 on Windows 7 Pin
Dave Kreskowiak17-Dec-09 2:28
mveDave Kreskowiak17-Dec-09 2:28 
GeneralRe: SysWOW64 on Windows 7 Pin
JR21217-Dec-09 23:15
JR21217-Dec-09 23:15 
QuestionAn unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll Pin
goodyear9915-Dec-09 14:22
goodyear9915-Dec-09 14:22 
Dear all,

I'm trying to call a function in a DLL. And I code a Connector to connect it.
But I'm getting the error message at "Marshal.FreeHGlobal(ptr)".
Sorry, this is my first time touch on DLL. And I have to continue previous developer project which is this.

Below are my codes , please kindly advise. Thanks

VB Form
Imports DRS40Connector.Dpi32
Imports System.Text
Imports Excel
Imports System.IO
Imports System.Threading
Imports System.Data
Imports System.Data.OleDb
Imports System.Runtime.InteropServices
Imports System.Text.RegularExpressions

Public Class CheckCIDFrm

    Delegate Sub uploadToDRSDelegate() 'Thread-safe function call

    Private t1 As Thread 'Runs UpdateToDRS function

    'Thread-safe call to UploadToDRS function
    Private Sub UploadToDRSThread()

        If lblMsg.InvokeRequired Then
            Dim d As New uploadToDRSDelegate(AddressOf UploadToDRS)
            Me.Invoke(d)
        Else
            UploadToDRS()
        End If

    End Sub

    'Upload Customer Records to DRS
    Private Sub UploadToDRS()
        'Disable upload btn

        Dim cdb As New DpiCdb_t()

        Dim result As Integer = CustomerEnquiry(TextBox1.Text, cdb)

        If result = CallFailure Then

            MessageBox.Show(GetError(dpi))

        Else

            MessageBox.Show("It works")

        End If

    End Sub

    Public Function CustomerEnquiry(ByVal customerID As Double, ByRef cdb As DpiCdb_t) As Boolean
        ' Not interested in announcements
        ' Disable announcement retrieval

        'DpiEnaAno(_dpi, False)

        ' Not interested in customer picture
        ' Allocate empty picture buffer

        Dim picCap As Integer = 0
        Dim picBuf As Byte() = New Byte(picCap - 1) {}
        Dim picLen As Integer = 0

        ' Not interested in customer signature
        ' Allocate empty signature picture buffer

        Dim sigCap As Integer = 0
        Dim sigBuf As Byte() = New Byte(sigCap - 1) {}
        Dim sigLen As Integer = 0

        ' Allocate customer database block

        'cdb = New DpiCdb_t()
        Dim ptr As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cdb))
        Marshal.StructureToPtr(cdb, ptr, False)

        ' Retrieve customer information

        Dim result As Integer = -1
        Try
            result = DpiGcdi(dpi, String.Empty, customerID, ptr, picBuf, picLen, picCap, sigBuf, sigLen, sigCap)
            cdb = CType(Marshal.PtrToStructure(ptr, GetType(DpiCdb_t)), DpiCdb_t)
        Finally

            ' Always free the unmanaged memory

            If ptr <> IntPtr.Zero Then
                Marshal.FreeHGlobal(ptr)
            End If

        End Try

        ' Return true if successful, otherwise false

        Return result = 0
    End Function

    'Get Error from DRS
    Private Function GetError(ByRef dpi As Dpi_t) As String
        Dim errMsg As New StringBuilder(DPI_ERR_LEN + 1)
        DpiErr(dpi, errMsg)

        Return errMsg.ToString
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        t1 = New Thread(AddressOf UploadToDRSThread)
        t1.Start()

    End Sub

End Class


DLL Connector

Public Class Dpi32
    Public Const CallSuccess As Integer = 0
    Public Const CallFailure As Integer = -1

    Public Const DPI_CRD_LEN = 16 'Card number
    Public Const DPI_CDA_LEN = 37 'Card data
    Public Const DPI_CTI_LEN = 10 'Customer title
    Public Const DPI_CNM_LEN = 40 'Customer name
    Public Const DPI_CIL_LEN = 4  'Complimentary issue location number
    Public Const DPI_UID_LEN = 8  'User identifier
    Public Const DPI_UPW_LEN = 40 'Password length
    Public Const DPI_LNM_LEN = 40 'Long user name
    Public Const DPI_ERR_LEN = 80 'Error message
    Public Const DPI_PRG_LEN = 40 'Program path name length
    Public Const DPI_R32_CTC_LEN = 3 'Release 32 cust type code length (3-chars)
    Public Const DPI_CTC_LEN = 4     'Customer type code length
    Public Const DPI_CTD_LEN = 40    'Customer type description length
    Public Const DPI_IPN_LEN = 15    'IC/passport number length
    Public Const DPI_IPT_LEN = 1     'IC/passport type length
    Public Const DPI_R38_ADL_LEN = 25 'Release 38 address line length
    Public Const DPI_ADL_LEN = 35     'Address line length
    Public Const DPI_CTY_LEN = 15     'City name length
    Public Const DPI_STE_LEN = 15     'State name length
    Public Const DPI_CON_LEN = 15     'Country name length
    Public Const DPI_R38_PCD_LEN = 7  'Release 38 post code length
    Public Const DPI_PCD_LEN = 10     'Post code length
    Public Const DPI_ARC_LEN = 2      'Area code length
    Public Const DPI_TNM_LEN = 51     'Title and name length
    Public Const DPI_PZD_LEN = 40     'Prize description length
    Public Const DPI_PCI_LEN = 4      'Profit centre identifier length
    Public Const DPI_PCN_LEN = 40     'Profit centre name length
    Public Const DPI_CYC_LEN = 2      'Currency code length
    Public Const DPI_CAR_LEN = 40     'Complimentary adjustment remarks
    Public Const DPI_SDT_LEN = 8      'String date length
    Public Const DPI_STM_LEN = 6      'String time length
    Public Const DPI_ATD_LEN = 10     'Address/telephone descrition length
    Public Const DPI_TEL_LEN = 20     'Telephone number length
    Public Const DPI_PFI_LEN = 4      'Preference flag identifier length
    Public Const DPI_PFV_LEN = 40     'Preference flag value length
    Public Const DPI_R37_PFV_LEN = 6  'Release 37 preference flag value length
    Public Const DPI_WGN_LEN = 4      'Work group name length
    Public Const DPI_GEN_LEN = 1      'Gender length
    Public Const DPI_BUS_LEN = 40     'Business or employer's name length
    Public Const DPI_COTC_LEN = 3     'Contact type code length
    Public Const DPI_MAX_HOST = 10    'Maximum host computers
    Public Const DPI_MAX_TER = 6      'Maximum telephone records
    Public Const DPI_R32_MAX_PFR = 36 'Max pref flag records as at release 32
    Public Const DPI_R37_MAX_PFR = 60 'Max pref flag records as at release 37
    Public Const DPI_MAX_PFR = 120    'Maximum preference flag records
    Public Const DPI_EMA_LEN = 129    'Email address
    Public Const DPI_CXT_LEN = 4      'Customer transaction type
    Public Const DPI_FAI_LEN = 4      'Facility identifier
    Public Const DPI_CMD_LEN = 4      'Command name
    Public Const DPI_BCS_LEN = 2048   'Background command string
    Public Const DPI_IPA_LEN = 15     'IP address
    Public Const DPI_FNM_LEN = 20     'File name
    Public Const DPI_EC_PIN_LEN = 8   'E-cash PIN length
    Public Const DPI_ROOM_NO_LEN = 8  'Room number length
    Public Const DPI_LANG_CODE_LEN = 2 'Language code length
    Public Const DPI_TXID_LEN = 20    'Transaction identifier
    Public Const DPI_SID_LEN = 40     'Stored image description
    Public Const DPI_CCT_BAL_STR_LEN = 10 'Credit card term balance string
    Public Const DPI_ANO_CODE_LEN As Integer = 4 'Announcement code
    Public Const DPI_MAX_ANO As Integer = 8 'Maximum announcement records
    Public Const DPI_MAX_ANO_TEXT_BUF As Integer = 8192 'Maximum announcement records
    Public Const DPI_ANO_TEXT_LEN As Integer = 8192

    'ADDRESS/TELEPHONE STATES
    Public Const DPI_ATS_OK As Integer = 0   'OK
    Public Const DPI_ATS_BL As Integer = 1   'Blocked
    Public Const DPI_ATS_XX As Integer = 2   'Invalid

    'DPI data block structure
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure Dpi_t
        'Unix protocol services daemon
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_PRG_LEN + 1)> _
        Dim dpiDrSuPsd As String

        'Pointer to communications data
        Dim dpiVoidCom As IntPtr

        'Pointer to client environment header
        Dim dpiVoidCeh As IntPtr

        'Response body
        Dim dpiRspBdy As IntPtr

        'Response length
        Dim dpiRspLen As Integer

        'Customer Maintenance data
        Dim dpiCmData As IntPtr

        'Read Customer Transactions data
        Dim dpiRdcxData As IntPtr

        'Last error code
        Dim dpiLstErr As Integer

        'Last rejection mode
        Dim dpiLstRejMode As Short

        Dim dpiCdb As IntPtr

        'Override no update authorisation
        Dim dpiONoUa As Byte

        'Override too much
        Dim dpiOTooMuch As Byte

        'Override barred customer
        Dim dpiOBar As Byte

        'Validate PIN on next GCDC/GCDI
        Dim dpiVPin As Byte

        'Personal identification number
        Dim dpiPin As Integer  'long

        'Card data
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CDA_LEN + 1)> _
        Dim dpiCda As String

        'Enquiry currency code (if any)
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CYC_LEN + 1)> _
        Dim dpiEcCyc As String

        'Address type
        Dim dpiAdSel As Short

        'Transaction identifier
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_TXID_LEN + 1)> _
        Dim dpiTxid As String

        'Profit centre identifier
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_PCI_LEN + 1)> _
        Dim dpiPci As String

        'Complimentary issue location
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CIL_LEN + 1)> _
        Dim dpiCil As String

        'Approver's ID & password
        Dim dpiEcoApprUidUpw As DpiEcoApprUidUpw_t

        'Approver's card data
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CDA_LEN + 1)> _
        Dim dpiEcoApprCda As String

        'Approver's type
        Dim dpiEcoAppr As Short

        'Rounding adjustment
        Dim dpiEcoRndAdj As Double

        'Area entry user identifier
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_UID_LEN + 1)> _
        Dim dpiAentUid As String

        'Area entry long user name
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_LNM_LEN + 1)> _
        Dim dpiAentLnm As String
    End Structure

    'ECO AMLA approver id & password structure
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiEcoApprUidUpw_t
        'Approver's ID
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_UID_LEN + 1)> _
        Dim dpiEcoApprUidUpwUid As String

        'Approver's password
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_UPW_LEN + 1)> _
        Dim dpiEcoApprUidUpwUpw As String
    End Structure
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiPfi_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_PFI_LEN + 1)> _
        Dim dpiPfrPfi As String

    End Structure

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiPfv_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_PFV_LEN + 1)> _
        Dim dpiPfrPfv As String

    End Structure

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiTel_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_TEL_LEN + 1)> _
        Dim dpiTerTel As String

    End Structure

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiAnoCode_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ANO_CODE_LEN + 1)> _
        Dim dpiAnoCode As String

    End Structure

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiAnoText_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ANO_TEXT_LEN + 1)> _
        Dim dpiAnoText As String

    End Structure

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
    Public Structure DpiAtd_t

        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ATD_LEN + 1)> _
        Dim dpiTerAtd As String

    End Structure

    Public Class DpiCsb_t

        Public Const DPI_CSB_OK As Integer = 0
        Public Const DPI_CSB_SUS As Integer = 1
        Public Const DPI_CSB_RES As Integer = 2
        Public Const DPI_CSB_BAR As Integer = 4
        Public Const DPI_CSB_CVL As Integer = 8
        Public Const DPI_CSB_CPD As Integer = 16
        Public Const DPI_CSB_SEC As Integer = 32


    End Class

#Region "CUSTOMER DATA BLOCK"

    ''' <summary>Customer data block</summary>
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=4)> _
    Public Structure DpiCdb_t
#Region "Financial figures"

        ''' <summary>Visible entitlement balance</summary>
        Public dpiVisBal As Double

        ''' <summary>Hidden reserve balance</summary>
        Public dpiHidBal As Double

        ''' <summary>Loyalty point balance</summary>
        Public dpiLptBal As Double

        ''' <summary>Cash e-cash balance</summary>
        Public dpiCecBal As Double

        ''' <summary>Non-neg e-cash balance</summary>
        Public dpiNecBal As Double

        ''' <summary>Comp overdraft limit</summary>
        Public dpiCol As Double

        ''' <summary>Cross drawdown visible balance</summary>
        Public dpiVisXdd As Double

        ''' <summary>Cross drawdown hidden balance</summary>
        Public dpiHidXdd As Double

        ''' <summary>Cross drawdown loyalty balance</summary>
        Public dpiLptXdd As Double

        ''' <summary>Cross drawdown comp o/d limit</summary>
        Public dpiColXdd As Double

        ''' <summary>Displayable visible balance</summary>
        Public dpiVisDsp As Double

        ''' <summary>Displayable loyalty balance</summary>
        Public dpiLptDsp As Double

        ''' <summary>Expiry look-ahead amount</summary>
        Public dpiXlaAmt As Double

        ''' <summary>Visible entitlement available</summary>
        Public dpiVisAvl As Double

#End Region

#Region "Miscellaneous information"

        ''' <summary>Time of the query</summary>
        Public dpiTim As Integer

        ''' <summary>Customer identifier</summary>
        Public dpiCid As Double

        ''' <summary>Last customer transfer time</summary>
        Public dpiLczTim As Integer

        ''' <summary>Number of telephone records</summary>
        Public dpiTerCnt As UInteger

        ''' <summary>Number of preference flag records</summary>
        Public dpiPfrCnt As UInteger

        ''' <summary>Customer status bitmap</summary>
        Public dpiCsb As DpiCsb_t

        ''' <summary>Customer class</summary>
        Public dpiCcl As Short

        ''' <summary>Expiry look-ahead period (days)</summary>
        Public dpiXlaPrd As Short

        ''' <summary>Room booking limit</summary>
        Public dpiRmLim As Short

        ''' <summary>Customer title</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CTI_LEN + 1)> _
        Public dpiCti As String

        ''' <summary>Customer name</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CNM_LEN + 1)> _
        Public dpiCnm As String

        ''' <summary>Customer gender</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_GEN_LEN + 1)> _
        Public dpiGen As String

        ''' <summary>Customer type code</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CTC_LEN + 1)> _
        Public dpiCtc As String

        ''' <summary>Customer type description</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CTD_LEN + 1)> _
        Public dpiCtd As String

        ''' <summary>Date of birth</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiDob As String

        ''' <summary>Date added</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiDad As String

        ''' <summary>Last Customer Maintenance date</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiLcmDat As String

        ''' <summary>Loyalty point last activity date</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiLptLdt As String

        ''' <summary>Card expiry date</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiCrdExp As String

        ''' <summary>Last play date</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiLpd As String

        ''' <summary>Last customer transfer date</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_SDT_LEN + 1)> _
        Public dpiLczDat As String

        ''' <summary>Customer currency code</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CYC_LEN + 1)> _
        Public dpiCcCyc As String

        ''' <summary>This facility identifier</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_FAI_LEN + 1)> _
        Public dpiThisFai As String

        ''' <summary>Update inst facility identifier</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_FAI_LEN + 1)> _
        Public dpiUiFai As String

        ''' <summary>Home inst facility identifier</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_FAI_LEN + 1)> _
        Public dpiHiFai As String

        ''' <summary>Preferred language</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_LANG_CODE_LEN + 1)> _
        Public dpiPrefLang As String

        ''' <summary>Lang code of national script</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_LANG_CODE_LEN + 1)> _
        Public dpiNasLang As String

        ''' <summary>Customer name in national script</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CNM_LEN + 1)> _
        Public dpiNasCnm As String

        ''' <summary>Customer title in national script</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CTI_LEN + 1)> _
        Public dpiNasCti As String

        ''' <summary>Show visible balance flag</summary>
        <MarshalAs(UnmanagedType.I1)> _
        Public dpiShowVisBal As Boolean

        ''' <summary>Visible balance string</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CCT_BAL_STR_LEN + 1)> _
        Public dpiVisBalStr As String

        ''' <summary>Show loyalty balance flag</summary>
        <MarshalAs(UnmanagedType.I1)> _
        Public dpiShowLptBal As Boolean

        ''' <summary>Loyalty balance string</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CCT_BAL_STR_LEN + 1)> _
        Public dpiLptBalStr As String

        ''' <summary>Region code</summary>
        Public dpiRgn As Short

        ''' <summary>Number of announcement</summary>
        Public dpiAnoCnt As UInteger

#End Region

#Region "IC/Passport details"

        ''' <summary>IC/passport number</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_IPN_LEN + 1)> _
        Public dpiIpn As String

        ''' <summary>IC/passport type ("I" or "P")</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_IPT_LEN + 1)> _
        Public dpiIpt As String

        ''' <summary>IC/passport country</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CON_LEN + 1)> _
        Public dpiIpc As String

#End Region

#Region "Customer's address"

        ''' <summary>Address line 1</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ADL_LEN + 1)> _
        Public dpiAd1 As String

        ''' <summary>Address line 2</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ADL_LEN + 1)> _
        Public dpiAd2 As String

        ''' <summary>Address line 3</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_ADL_LEN + 1)> _
        Public dpiAd3 As String

        ''' <summary>City</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CTY_LEN + 1)> _
        Public dpiCty As String

        ''' <summary>State</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_STE_LEN + 1)> _
        Public dpiSte As String

        ''' <summary>Country</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_CON_LEN + 1)> _
        Public dpiCon As String

        ''' <summary>Post code</summary>
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=DPI_PCD_LEN + 1)> _
        Public dpiPcd As String

#End Region

#Region "Customer's telephone records"

        ''' <summary>Customer's telephone records</summary>
        <MarshalAs(UnmanagedType.ByValArray, SizeConst:=DPI_MAX_TER)> _
        Public dpiTerArr As DpiTer_t()

#End Region

#Region "Preference flag records"

        ''' <summary>Preference flag records</summary>
        <MarshalAs(UnmanagedType.ByValArray, SizeConst:=DPI_MAX_PFR)> _
        Public dpiPfrArr As DpiPfr_t()

#End Region

#Region "Announcement records"

        ''' <summary>Announcement records</summary>
        <MarshalAs(UnmanagedType.ByValArray, SizeConst:=DPI_MAX_ANO)> _
        Public dpiAnoArr As DpiAno_t()

#End Region
    End Structure

#End Region

    ' TELEPHONE RECORD STRUCTURE

    Public Class DpiTer_t
        Public dpiTerAtd As New DpiAtd_t() ' Address/phone description
        Public dpiTerTel As New DpiTel_t() ' Telephone number
        Public dpiTerTe1 As SByte ' Best number flag
    End Class

    ' PREFERENCE FLAG RECORD STRUCTURE

    Public Class DpiPfr_t
        Public dpiPfrPfi As New DpiPfi_t() ' Preference flag identifier
        Public dpiPfrPfv As New DpiPfv_t() ' Preference flag value
    End Class

    ' ANNOUNCEMENT RECORD STRUCTURE

    Public Class DpiAno_t
        Public dpiAnoCode As New DpiAnoCode_t() ' Announcement code
        Public dpiAnoText As New DpiAnoText_t() ' Announcement text
    End Class

    'Initiation
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiIni(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cfgName As String, ByVal hInst As IntPtr) As Integer

    End Function

    'Log-on
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiOn(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cil As StringBuilder, <MarshalAs(UnmanagedType.LPStr)> ByVal uid As StringBuilder, <MarshalAs(UnmanagedType.LPStr)> ByVal upw As StringBuilder, <MarshalAs(UnmanagedType.LPStr)> ByVal cda As StringBuilder) As Integer

    End Function

    'Change work group
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCwg(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cil As String, <MarshalAs(UnmanagedType.LPStr)> ByVal wgn As String) As Integer

    End Function

    'Log-off
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiOff(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cil As StringBuilder) As Integer

    End Function

    'Terminate
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiTrm(ByRef dpi As Dpi_t) As Integer

    End Function

    'Return last error message
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiErr(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal err As StringBuilder) As Integer

    End Function


    'CUSTOMER MAINTENANCE FUNCTION DECLARATIONS


    'Initialise
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmIni(ByRef dpi As Dpi_t) As Integer

    End Function

    'Get customer identifier
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmGetCid(ByRef dpi As Dpi_t, ByRef cid As Double) As Integer

    End Function

    'Load general data
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadGen(ByRef dpi As Dpi_t, ByVal cid As Double, <MarshalAs(UnmanagedType.LPStr)> ByVal cnm As String, <MarshalAs(UnmanagedType.LPStr)> ByVal cti As String, <MarshalAs(UnmanagedType.LPStr)> ByVal dob As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ctc As String, <MarshalAs(UnmanagedType.LPStr)> ByVal gen As String, <MarshalAs(UnmanagedType.LPStr)> ByVal bus As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ipn As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ipt As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ipc As String, ByVal col As Double, ByVal raf As Integer, ByVal ced As Double, ByVal nac As String, ByVal telAts As Short, ByVal adrAts As Short, ByVal emaAts As Short) As Integer

    End Function

    'Load telephone number
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadTel(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal atd As String, <MarshalAs(UnmanagedType.LPStr)> ByVal tel As String, ByVal best As Integer) As Integer

    End Function

    'Load Address
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadAdr(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal atd As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ad1 As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ad2 As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ad3 As String, <MarshalAs(UnmanagedType.LPStr)> ByVal cty As String, <MarshalAs(UnmanagedType.LPStr)> ByVal ste As String, <MarshalAs(UnmanagedType.LPStr)> ByVal con As String, <MarshalAs(UnmanagedType.LPStr)> ByVal pcd As String, ByVal rgnId As Integer) As Integer

    End Function

    'Load Customer Email Address
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadEma(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal ema As String) As Integer

    End Function

    'Load customer currency code
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadCc(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cccyc As String) As Integer

    End Function

    'Load preference flag value
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmLoadPfv(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal pfi As String, <MarshalAs(UnmanagedType.LPStr)> ByVal pfv As String) As Integer

    End Function

    'Add Customer
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmAdd(ByRef dpi As Dpi_t) As Integer

    End Function

    'Change Customer
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmChg(ByRef dpi As Dpi_t) As Integer

    End Function

    'Terminate
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiCmTrm(ByRef dpi As Dpi_t) As Integer

    End Function


    'Append contact log entry
    <DllImport("dpi32.dll")> _
    Public Shared Function DpiClg(ByRef dpi As Dpi_t, ByVal cid As Double, <MarshalAs(UnmanagedType.LPStr)> ByVal dat As String, <MarshalAs(UnmanagedType.LPStr)> ByVal tim As String, <MarshalAs(UnmanagedType.LPStr)> ByVal uid As String, <MarshalAs(UnmanagedType.LPStr)> ByVal cotc As String, ByVal con As String, <MarshalAs(UnmanagedType.LPStr)> ByVal fud As String) As Integer

    End Function

    <DllImport("dpi32.dll")> _
    Public Shared Function DpiGcdi(ByRef dpi As Dpi_t, <MarshalAs(UnmanagedType.LPStr)> ByVal cil As String, ByVal cid As Double, ByVal cdb As IntPtr, <MarshalAs(UnmanagedType.LPArray)> ByVal pic As Byte(), ByRef picLen As Integer, _
    ByVal picCap As Integer, <MarshalAs(UnmanagedType.LPArray)> ByVal sig As Byte(), ByRef sigLen As Integer, ByVal sigCap As Integer) As Integer
    End Function

End Class

AnswerRe: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll Pin
Gideon Engelberth15-Dec-09 16:46
Gideon Engelberth15-Dec-09 16:46 
QuestionQuestion regarding filesystemwatcher and existing files Pin
Jon_Boy15-Dec-09 5:22
Jon_Boy15-Dec-09 5:22 
AnswerRe: Question regarding filesystemwatcher and existing files Pin
DaveAuld15-Dec-09 5:36
professionalDaveAuld15-Dec-09 5:36 
GeneralRe: Question regarding filesystemwatcher and existing files Pin
Jon_Boy15-Dec-09 5:39
Jon_Boy15-Dec-09 5:39 
GeneralRe: Question regarding filesystemwatcher and existing files Pin
Ian Shlasko15-Dec-09 8:02
Ian Shlasko15-Dec-09 8:02 
GeneralRe: Question regarding filesystemwatcher and existing files Pin
Jon_Boy15-Dec-09 8:55
Jon_Boy15-Dec-09 8:55 
GeneralRe: Question regarding filesystemwatcher and existing files Pin
Ian Shlasko15-Dec-09 9:39
Ian Shlasko15-Dec-09 9:39 
QuestionBuilding an application that recieves emails Pin
Aptiva Dave15-Dec-09 4:25
Aptiva Dave15-Dec-09 4:25 
AnswerRe: Building an application that recieves emails Pin
dan!sh 15-Dec-09 5:08
professional dan!sh 15-Dec-09 5:08 
AnswerCheck this article out for reading email ... Pin
David Mujica15-Dec-09 5:24
David Mujica15-Dec-09 5:24 
AnswerRe: Building an application that recieves emails [modified] Pin
plecco22-Dec-09 8:49
plecco22-Dec-09 8:49 
Questionimage capture and object tracking Pin
voodoo_god15-Dec-09 3:46
voodoo_god15-Dec-09 3:46 
QuestionDatagridviewButtoncell accroding to the value of cell() Pin
Paramu197314-Dec-09 22:19
Paramu197314-Dec-09 22:19 
QuestionReplacing Bytes in an Office 2003 Word Document Pin
jonegerton14-Dec-09 3:25
jonegerton14-Dec-09 3:25 
AnswerRe: Replacing Bytes in an Office 2003 Word Document Pin
Richard MacCutchan14-Dec-09 5:05
mveRichard MacCutchan14-Dec-09 5:05 
GeneralRe: Replacing Bytes in an Office 2003 Word Document Pin
jonegerton14-Dec-09 6:32
jonegerton14-Dec-09 6:32 
GeneralRe: Replacing Bytes in an Office 2003 Word Document Pin
The Man from U.N.C.L.E.14-Dec-09 7:33
The Man from U.N.C.L.E.14-Dec-09 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.