dmtGetSlotInfobyIndex

Funzione di utilitą che restituisce in un colpo solo tutte le informazioni riguardanti un lettore installato sul PC specificando l'indice base 0 (in caso ce ne sono pił di uno) . Restituisce le informazioni di Slot, token e Sessione. I dati sono restituiti attraverso come puntatori alle relative strutture

 

 

Dichiarazione - C

  LONG WINAPI dmtGetSlotInfobyIndex(HDMTOBJ hDmt, LONG iIndex,

   TOKEN_INFO *TokenInfo , SESSION_INFO *SessionInfo,

   SLOT_INFO *SlotInfo );

 

Dichiarazione - C#

         [DllImport("Dimatec.dll")]

         public static extern int dmtGetSlotInfobyIndex(

             int hDmt,

             int iIndex,

             ref TOKEN_INFO lpTokenInfo ,

             ref SESSION_INFO lpSessionInfo,

             ref SLOT_INFO lpSlotInfo );

 

 

Dichiarazione - Visual Basic

Public Declare Function dmtGetSlotInfobyIndex Lib "DiMaTec.dll" _

                                    (ByVal hDmt As Long, _

                                     ByVal iIndex As Long, _

                                     ByRef lpTokenInfo As TOKEN_INFO, _

                                     ByRef  lpSessionInfo SESSION_INFO, _

                                     ByRef  lpSlotInfo SLOT_INFO) _

                                     As Long

 

Dichiarazione - Delphi

function dmtGetSlotInfobyIndex (hDmt : longint; iIndex : longint;  var TokenInfo: TOKEN_INFO ; var SessionInfo: SESSION_INFO ; var SlotInfo: SLOT_INFO )  : longint; stdcall; external 'DiMaTec.dll';

  

Parametri di input:
Parametri di output:
Valore di ritorno:

DMT_OK in caso di successo, altrimenti un codice di errore

 

 


Esempi di utilizzo

 

Esempio C#

                   // Le stringhe devono avere lunghezza definita

                    ldSlotInfo.SlotDescription = new String((char)13, 64);

                    ldSlotInfo.ManufacturerID = new String((char)13, 32);

                    ldSlotInfo.flags = new int();

                    ldTokenInfo.Label = new String((char)13, 64);

                    ldTokenInfo.ManufacturerID = new String((char)13, 64);

                    ldTokenInfo.Model = new String((char)13, 64);

                    ldTokenInfo.SerialNumber = new String((char)13, 64);

                    ldTokenInfo.flags = new int();

                    lsessioninfo.flags = new int();

                    lsessioninfo.slotID = new int();

                    lsessioninfo.state= new int();

                    lsessioninfo.ulDeviceError = new int();

  

                   // verifica dei lettori installati

                    int ireadercount = CDIMATECLIBRARY.dmtGetCountSlotList(CDIMATECLIBRARY.ghDimatecObj, true);

                    for (int i = 0; i < ireadercount; i++)

                    {

                        int SlotInfoResult = CDIMATECLIBRARY.dmtGetSlotInfobyIndex(

                        CDIMATECLIBRARY.ghDimatecObj,

                        i, ref ldTokenInfo, ref lsessioninfo, ref ldSlotInfo);

                        comboBox1.Items.Add(ldSlotInfo.SlotDescription);

                    }

                    

                    MessageBox.Show(this, "DiMaTec initialization succeed", "DimatecInitialization",

                        MessageBoxButtons.OK, MessageBoxIcon.Information);