Jeff Graham
C# example using WD 16 .NET assembly December 15, 2011 05:18PM |
// .NET assebly for accessing HF Fingerprints and Accounts from C# //--- LOG ---------------------------------------------------------------------------------------------------------------------------------- //2011-09-06 JWG clHFAccess - New class //2011-11-08 JWG Note that properties do not seem to show in C# even if marked PUBLIC => must have Get.. and Set.. methods //--- END LOG ------------------------------------------------------------------------------------------------------------------------------ clHFAccess is class PRIVATE m_cnxHFConn is Connection m_bufFingerprints is Buffer m_sTestString is string = "Default value!" gm_sDataPath is string = "<none>" PUBLIC gm_bIsConnected is boolean = False gm_iNbrRecords is int = 0 END PROCEDURE PUBLIC p_sDataPath() RESULT gm_sDataPath PROCEDURE PUBLIC p_sDataPath(sValue is string) HCloseConnection(m_cnxHFConn) gm_bIsConnected = False IF fDirectoryExist(sValue) THEN m_cnxHFConn..Source = sValue IF HOpenConnection(m_cnxHFConn) THEN IF HChangeConnection(Fingerprints,m_cnxHFConn) THEN // Only file used by this .NET dll gm_bIsConnected = True gm_iNbrRecords = HNbRec(Fingerprints) gm_bIsConnected = False gm_sDataPath = sValue END END END PROCEDURE PUBLIC p_sTestString() RESULT m_sTestString PROCEDURE PUBLIC p_sTestString(par_Value is string) m_sTestString = par_Value PROCEDURE Constructor() // Set public property to indicate HF is connected //gm_sDataPath = fDataDir() // This does not work as fDataDir unique to WinDev gm_sDataPath = fCurrentDir() m_cnxHFConn..Provider=hAccessHF7 m_cnxHFConn..Password = "" m_cnxHFConn..Source=fDataDir() //+"\Fingerprints.fic" IF HOpenConnection(m_cnxHFConn) THEN IF HChangeConnection(Fingerprints,m_cnxHFConn) THEN // Only file used by this .NET dll gm_bIsConnected = True gm_iNbrRecords = HNbRec(Fingerprints) gm_bIsConnected = False END END RESULT gm_bIsConnected PROCEDURE Destructor() // NOTE - This code causes AccessViolationException //if gm_bIsConnected then // HCloseConnection(m_cnxHFConn) //END // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] GetNextFingerprint (<ID> is int, <iAccountsID> is int, <iDistrictStudentNbr> is int, <aFeatures>) // // Parameters: // ID (int): Fingerprints ID // iAccountsID (int): AccMeals account identifier // iDistrictStudentNbr (int): Unique identifier of student // aFeatures: Template data // Return Value: // boolean: // None // // For instance: // Indicate an example. // //PROCEDURE GetNextFingerprint(LOCAL ID is int, LOCAL iAccountsID is int, LOCAL iDistrictStudentNbr is int, LOCAL aFeatures is array of byte ) PROCEDURE GetNextFingerprint(ID is int, iAccountsID is int, iDistrictStudentNbr is int, aFeatures) // is array of byte ) bResult is boolean = HReadNext(Fingerprints,ID,hLockNo) IF bResult THEN ID = Fingerprints.ID iAccountsID = Fingerprints.AccountsID iDistrictStudentNbr = Fingerprints.DistrictStudentNbr IF Fingerprints.Features..Null = False THEN // aFeatures = Fingerprints.Features Deserialize(aFeatures,Fingerprints.Features,psdBinary) END END RESULT bResult //result gm_bIsConnected // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] GetTestString () // // Parameters: // None // Return Value: // string: // None // // For instance: // Indicate an example. // PROCEDURE GetTestString() RESULT m_sTestString // Summary: <specify the procedure action> // Syntax: //SetTestString (<sValue> is string) // // Parameters: // sValue (string): <specify the role of value> // Return Value: // None // // For instance: // Indicate an example. // PROCEDURE SetTestString(LOCAL sValue is string) m_sTestString = sValue //PROCEDURE GetFirstFingerprint(local ID is int, LOCAL iAccountsID is int, LOCAL iDistrictStudentNbr is int, LOCAL aFeatures is array of byte ) PROCEDURE GetFirstFingerprint(ID is int, iAccountsID is int, iDistrictStudentNbr is int, aFeatures) // is array of byte ) bResult is boolean = HReadFirst(Fingerprints) IF bResult THEN ID = Fingerprints.ID iAccountsID = Fingerprints.AccountsID iDistrictStudentNbr = Fingerprints.DistrictStudentNbr IF Fingerprints.Features..Null = False THEN // aFeatures = Fingerprints.Features Deserialize(aFeatures,Fingerprints.Features,psdBinary) END END RESULT bResult // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] WriteData (<iAccountsID> is int, <iDistrictStudentNbr> is int, <sFingerID> is string, <aTemplate> is array) // // Parameters: // iAccountsID (int): <specify the role of siAccountsID> // iDistrictStudentNbr (int): <specify the role of siDistrictStudentNbr> // sFingerID (string): <specify the role of sFingerID> // aTemplate (array): <specify the role of bufFeatures> // Return Value: // boolean: // None // // For instance: // Indicate an example. // //PROCEDURE WriteData(iAccountsID is int, iDistrictStudentNbr is int, sFingerID is string, aFeatures is array of byte ) // This causes "ref <parm>" calls PROCEDURE WriteData(LOCAL iAccountsID is int, LOCAL iDistrictStudentNbr is int, LOCAL sFingerID is string, LOCAL aTemplate is array of 1-byte unsigned int ) bSuccess is boolean = False HReset(Fingerprints) Fingerprints.AccountsID = iAccountsID Fingerprints.DistrictStudentNbr = iDistrictStudentNbr Fingerprints.FingerID = sFingerID //Serialize(aFeatures,Fingerprints.Features,psdBinary) //Fingerprints.Features = aTemplate // just puts address in binary field bufTemplate is Buffer Serialize(aTemplate,bufTemplate,psdBinary) Fingerprints.Features = bufTemplate IF HAdd(Fingerprints) THEN bSuccess = True END gm_iNbrRecords = HNbRec(Fingerprints) // Update class info RESULT bSuccess // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] TestA (<p1> is int, <p2> is array) // // Parameters: // p1 (int): <specify the role of p1> // p2 (array): <specify the role of p2> // Return Value: // boolean: // None // // For instance: // Indicate an example. // PROCEDURE TestA(p1 is int,p2 is array of byte) temp is array of byte = [1,2,3] p1 += 1 p2 = temp RESULT True // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] TestB (<p1> is int, <p2>) // // Parameters: // p1 (int): <specify the role of p1> // p2: <specify the role of p2> // Return Value: // boolean: // None // // For instance: // Indicate an example. // PROCEDURE TestB(p1 is int, p2) temp is array of byte = [2,3,4,5] p1 += 1 p2 = temp RESULT True // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] TestC (<p1> is int [, <p2> is array]) // // Parameters: // p1 (int): <specify the role of p1> // p2 (array - default value=0): <specify the role of p2> // Return Value: // boolean: // None // // For instance: // Indicate an example. // PROCEDURE TestC(p1 is int,p2 is array of 1-byte unsigned int = Null) temp is array of byte = [10,11,12] p1 += 1 IF MyParameters..NbReceived = 2 THEN p2 = temp RESULT True ELSE RESULT False END // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] TestD (<p1> is int, <p2> is COMObject) // // Parameters: // p1 (int): <specify the role of p1> // p2 (COMObject): <specify the role of p2> // Return Value: // boolean: // None // // For instance: // Indicate an example. // // p1 (int): <specify the role of p1> // p2 (array - default value=0): <specify the role of p2> PROCEDURE TestD(p1 is int, p2 is COMObject) temp is array of byte = [13,14,15] p1 += 1 IF MyParameters..NbReceived = 2 THEN p2 = temp RESULT True ELSE RESULT False END // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] GetDataPath () // // Parameters: // None // Return Value: // string: // None // // For instance: // Indicate an example. // PROCEDURE GetDataPath() RESULT p_sDataPath // Summary: <specify the procedure action> // Syntax: //SetDataPath (<sValue> is string) // // Parameters: // sValue (string): <specify the role of sValue> // Return Value: // None // // For instance: // Indicate an example. // PROCEDURE SetDataPath(LOCAL sValue is string) p_sDataPath = sValue // Summary: <specify the procedure action> // Syntax: //[ <Result> = ] CloseDB () // // Parameters: // None // Return Value: // boolean: // None // // For instance: // Indicate an example. // PROCEDURE CloseDB() IF HCloseConnection(m_cnxHFConn) THEN gm_bIsConnected = False END RESULT gm_bIsConnected
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Odbc; using System.Data.OleDb; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using Neurotec.Biometrics; using Neurotec.Licensing; using WL; namespace Test_CS { public partial class FormTest : Form { public FormTest() { InitializeComponent(); } private string pathTestData = @"D:\BioMetrics\Test_Data"; private void buttonOLE_Click(object sender, EventArgs e) { /* Connection to a HyperFileSQL Classic database without specifying the analysis: Provider=PCSOFT.HFSQL;Initial Catalog=c:\My HyperFileSQL Database Connection to a HyperFileSQL Classic database byspecifying the analysis: Provider=PCSOFT.HFSQL;Data Source=c:\My HyperFileSQL Database\MyAnalysis.wdd;Initial Catalog=c:\My HyperFileSQL Database Connection to a HyperFileSQL Client/Server database: Provider=PCSOFT.HFSQL;Data Source=serverdb.mycompany.fr:4910;User ID=admin;Password=secret;Initial Catalog=MyDatabase Connection to a HyperFileSQL Client/Server database with password-protected files that use the Russian character set: Provider=PCSOFT.HFSQL;Data Source=serverdb.mycompany.fr;User ID=user;Initial Catalog=MyRussianDatabase;Extended Properties="Password=*:secret1;Password=File2:secret2;Language=KOI8-R" Note: In this example, all the database files are protected by the "secret1" password except for the "File2" file that is protected by the "secret2" password. */ textOLE.Text = ""; try { System.Data.OleDb.OleDbConnection myOleDb = new System.Data.OleDb.OleDbConnection (@"Provider=PCSOFT.HFSQL;Data Source=D:\BioMetrics\\VF_CS_Test\\VF_CS_Test.wdd;Initial Catalog="+pathTestData+";"); //D:\\BioMetrics\\WD_Net\\Exe;"); //("Provider=PCSOFT.HFSQL;Data Source=D:\\BioMetrics\\VF_CS_Test\\VF_CS_Test.wdd;Initial Catalog=D:\\BioMetrics\\VF_CS_Test\\exe:"); // (Provider=PCSOFT.HFSQL;Data Source=c:\My HyperFileSQL Database\MyAnalysis.wdd;Initial Catalog=c:\My HyperFileSQL Database); //("Provider=PCSOFT.HFSQL;Data Source=c:\\My HyperFileSQL Database\\MyAnalysis.wdd;Initial Catalog=c:\\My HyperFileSQL Database"); myOleDb.Open(); // Specify the Query OleDbCommand MyQuery = new OleDbCommand("SELECT ID,AccountsID,DistrictStudentNbr,FingerID,Features FROM FingerPrints",myOleDb); // Run the Query //OleDbDataReader MyData = MyQuery.ExecuteReader(); // Read first OleDbDataReader MyDataReader = MyQuery.ExecuteReader(); //MyDataReader.Read(); // Display //textOLE.AppendText(MyDataReader.ToString()); for (int i = 1; i < 15; i++) { if (MyDataReader.Read()) { var ID = MyDataReader.GetValue(0); var accountID = MyDataReader.GetValue(1); var districtStudentNbr = MyDataReader.GetValue(2); var fingerID = MyDataReader.GetValue(3); var features = MyDataReader.GetValue(4); // Display textOLE.AppendText(string.Format("ID={0},AccountID={1},FingerID={2},FeaturesType={3}\n ",ID.ToString(),accountID.ToString(),fingerID,features.GetType())); } else { textOLE.AppendText("EOF"); break; } } // Close MyDataReader.Close(); myOleDb.Close(); } catch(Exception ex) { textOLE.AppendText("Error in connect: \n" + ex.Message); } } private void buttonMDB_Click(object sender, EventArgs e) { textMDB.Text = ""; try { System.Data.OleDb.OleDbConnection myMDB = new System.Data.OleDb.OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+pathTestData+@"\FPID.mdb;"); // D:\\BioMetrics\\VF_CS_Test\\Exe\\FPID.mdb;"); myMDB.Open(); // Specify the Query OleDbCommand MyQuery = new OleDbCommand("SELECT AccountsID FROM FingerPrints",myMD; OleDbCommand myCommand = myMDB.CreateCommand(); myCommand.CommandText = "FingerPrints"; // Run the Query OleDbDataReader MyDataReader = MyQuery.ExecuteReader(); for (int i = 1; i < 15; i++) { MyDataReader.Read(); var accountID = MyDataReader.GetValue(0); // Display textMDB.AppendText(accountID.ToString() + "; "); } // Close MyDataReader.Close(); myMDB.Close(); } catch (Exception ex) { textMDB.AppendText("Error in MDB: \n" + ex.Message); } } private void buttonConvert_Click(object sender, EventArgs e) { textConvert.Text = "Start of test.\n"; try { WL.clHFAccess hfAccess = new clHFAccess(); hfAccess.SetDataPath(@"D:\Biometrics\Test_Data"); int _AccountsID = 0; int _DistrictStudentNbr = 0; string _FingerID; //byte[] _FingerPrint; byte[] vf42_template; byte[] vf63_template; // Data access by using a DataSet FPIDTestDataSetTableAdapters.Fingerprints1TableAdapter taFP1 = new FPIDTestDataSetTableAdapters.Fingerprints1TableAdapter(); taFP1.Connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\BioMetrics\Test_Data\FPID.mdb"; FPIDTestDataSet dsFP1s = new FPIDTestDataSet(); taFP1.Fill(dsFP1s.Fingerprints1); textConvert.AppendText(string.Format("WD Fingerprints: {2} Data path = {0}\nAccess MDB path = {1}\n",hfAccess.GetDataPath(),taFP1.Connection.DataSource,hfAccess.gm_iNbrRecords)); int iCount = 0; foreach (FPIDTestDataSet.Fingerprints1Row fingerprint in dsFP1s.Fingerprints1.Rows) { iCount++; //if (iCount > 15) break; // Convert old template to new format: vf42_template = fingerprint.Features; NFRecord nfrecord = new NFRecord(vf42_template); vf63_template = nfrecord.Save(); // Write to HF _AccountsID = fingerprint.AccountsID; _DistrictStudentNbr = fingerprint.DistrictStudentNbr; _FingerID = fingerprint.FingerID; if (hfAccess.WriteData(_AccountsID, _DistrictStudentNbr, _FingerID, vf63_template) ) { // Message textConvert.AppendText(fingerprint.AccountsID.ToString() + "; "); } else { textConvert.AppendText("Error: "+fingerprint.AccountsID.ToString() + "; "); } nfrecord.Dispose(); } textConvert.AppendText(string.Format("\nAdded {0} HF fingerprints.\n Now {1} fingerprints.",iCount,hfAccess.gm_iNbrRecords)); hfAccess = null; dsFP1s.Dispose(); taFP1.Dispose(); } catch (Exception ex) { // Display the errors textConvert.AppendText("Error: Source = " + ex.Source + "\n"); textConvert.AppendText("Error: Message = " + ex.Message + "\n"); } textConvert.AppendText(" End of test."); } private void buttonDataSet_Click(object sender, EventArgs e) // Read Access with dataset { textDataSet.Text = ""; try { // Data access by using a DataSet //FPIDDataSetTableAdapters.FingerprintsTableAdapter ctaFPID = new FPIDDataSetTableAdapters.FingerprintsTableAdapter; //FPIDDataSet FPIDDataSet_MDBTableAdapters.FingerprintsTableAdapter taFP = new FPIDDataSet_MDBTableAdapters.FingerprintsTableAdapter(); FPIDDataSet_MDB dsFPs = new FPIDDataSet_MDB(); taFP.Fill(dsFPs.Fingerprints); int iCount = 0; foreach (FPIDDataSet_MDB.FingerprintsRow fingerprint in dsFPs.Fingerprints.Rows) { iCount++; if (iCount > 15) break; textDataSet.AppendText(fingerprint.AccountsID.ToString() + "; "); } } catch (OdbcException eExcpt) { // Display the errors textDataSet.AppendText("Error: Source = " + eExcpt.Source); textDataSet.AppendText("Error: Message = " + eExcpt.Message); //Console.WriteLine("Source = " + eExcpt.Source); //Console.WriteLine("Message = " + eExcpt.Message); } } #region Comments and code showing limitations of PC Soft data access /* Note the code below gets the following exception: * The ICommandWithParameters interface is not supported by the 'PCSOFT.HFSQL' provider. * Command parameters are unsupported with the current provider. * try { // FPID Data access by using a DataSet FPIDDataSet_MDBTableAdapters.FingerprintsTableAdapter taFP = new FPIDDataSet_MDBTableAdapters.FingerprintsTableAdapter(); FPIDDataSet_MDB dsFPs = new FPIDDataSet_MDB(); taFP.Fill(dsFPs.Fingerprints); // .FIC access by ======================================================= System.Data.OleDb.OleDbConnection myFIC = new System.Data.OleDb.OleDbConnection ("Provider=PCSOFT.HFSQL;Data Source=D:\\BioMetrics\\VF_CS_Test\\VF_CS_Test.wdd;Initial Catalog=D:\\BioMetrics\\VF_CS_Test\\exe;"); // Experiment with making a data adapter for Insert & Modify OleDbDataAdapter adapter = CreateDataAdapter("SELECT * FROM Fingerprints", myFIC); DataSet dsFIC = new DataSet(); adapter.Fill(dsFIC); // Process FPID records int iCount = 0; foreach (FPIDDataSet_MDB.FingerprintsRow fingerprint in dsFPs.Fingerprints.Rows) { iCount++; if (iCount > 15) break; textConvert.AppendText(fingerprint.AccountsID.ToString() + "; "); // Add to FIC Fingerprints // Parameters not supported by PCSoft //DataRow newFIC = dsFIC.Tables[0].NewRow(); //newFIC["AccountsID"] = fingerprint.AccountsID; //newFIC["FingerID"] = fingerprint.FingerID; //newFIC["DistrictStudentNbr"] = fingerprint.DistrictStudentNbr; //byte[] vf42_template = fingerprint.Features; ////NFRecord nfrecord = new NFRecord(vf42_template); ////newFIC["Features"] = nfrecord; //newFIC["Features"] = vf42_template; //dsFIC.Tables[0].Rows.Add(newFIC); // Try commands: myFIC.Open(); OleDbCommand addFIC = new OleDbCommand( "INSERT INTO Fingerprints (AccountsID) " + "VALUES (?)", myFIC); //"INSERT INTO Fingerprints (Features, FingerID, AccountsID, DistrictStudentNbr) " + //"VALUES (?, ?, ?, ?)", myFIC); OleDbParameter p1 = new OleDbParameter(); addFIC.Parameters.Add(p1); p1.Value = fingerprint.AccountsID; //fingerprint.Features, fingerprint.FingerID, fingerprint.AccountsID, fingerprint.DistrictStudentNbr); //addFIC.CommandType = System.Data.CommandType.TableDirect; int iAdded = addFIC.ExecuteNonQuery(); MessageBox.Show("Added {0} rows.", iAdded.ToString()); } adapter.Update(dsFIC); } catch (OdbcException eExcpt) { // Display the errors textConvert.AppendText("Error: Source = " + eExcpt.Source); textConvert.AppendText("Error: Message = " + eExcpt.Message); //Console.WriteLine("Source = " + eExcpt.Source); //Console.WriteLine("Message = " + eExcpt.Message); } } public static OleDbDataAdapter CreateDataAdapter(string selectCommand, OleDbConnection connection) { } OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand, connection); adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; // Create the Insert, Update and Delete commands. adapter.InsertCommand = new OleDbCommand( "INSERT INTO Fingerprints (Features, FingerID, AccountsID, DistrictStudentNbr) " + "VALUES (?, ?, ?, ?)", connection); adapter.UpdateCommand = new OleDbCommand( "UPDATE Fingerprints SET Features = ?, FingerID, AccountsID = ?, DistrictStudentNbr = ? " + "WHERE AccountsID = ?", connection); adapter.DeleteCommand = new OleDbCommand( "DELETE FROM Fingerprints WHERE AccountsID = ?", connection); // Create the parameters. Add others !@!!!!!!!!!!!!!!!!! adapter.InsertCommand.Parameters.Add("@AccountsID", OleDbType.Integer, 10, "AccountsID"); adapter.InsertCommand.Parameters.Add("@DistrictStudentNbr", OleDbType.Integer, 10, "DistrictStudentNbr"); adapter.InsertCommand.Parameters.Add("@FingerID", OleDbType.VarChar, 50, "FingerID"); adapter.InsertCommand.Parameters.Add("@Features", OleDbType.Binary, 0, "Features"); adapter.UpdateCommand.Parameters.Add("@AccountsID", OleDbType.Integer, 10, "AccountsID"); adapter.UpdateCommand.Parameters.Add("@DistrictStudentNbr", OleDbType.Integer, 10, "DistrictStudentNbr"); adapter.UpdateCommand.Parameters.Add("@FingerID", OleDbType.VarChar, 50, "FingerID"); adapter.UpdateCommand.Parameters.Add("@Features", OleDbType.Binary, 0, "Features"); adapter.DeleteCommand.Parameters.Add("@AccountsID", OleDbType.Char, 5, "AccountsID").SourceVersion = DataRowVersion.Original; return (adapter); } */ #endregion private void buttonWL_Click(object sender, EventArgs e) { //var testWL = "Test"; //var param1 = "Param1"; //clLog testLog = new clLog(ref testWL, ref param1); WL.clHFAccess hfAccess = new clHFAccess(); textWL.Text = "Starting clHFAccess test.\n"; textWL.AppendText("Data Path = "+hfAccess.GetDataPath()+"\n"); textWL.AppendText("hfAccess.TestString = " + hfAccess.GetTestString()+"\n"); // Read records: textWL.AppendText( "\nStarting Records test usingg clAcess.\n"); textWL.AppendText("hfAccess.TestString = " + hfAccess.GetTestString() + "\n"); int nbrRecords = hfAccess.gm_iNbrRecords; textWL.AppendText("Number of Records = " + nbrRecords.ToString() + "\n"); int _ID = 0; int _AccountsID = 0; int _DistrictStudentNbr = 0; //var _FingerPrint = new Neurotec.IO.NBuffer(byte[]);// _Buffer); //NFRecord _FingerPrint = new NFRecord(); // _Buffer); //Neurotec.IO.NBuffer _FingerPrint; //byte[] _FingerPrint; //object _FingerPrint = new byte[100]; //Buffer _FingerPrint; //byte[] _FingerPrint = new byte[100]; //Byte[] _FingerPrint = new Byte[100]; //try //{ // if (hfAccess.GetFirstFingerprint(ref _ID, ref _AccountsID, ref _DistrictStudentNbr,ref _FingerPrint)) // //if (hfAccess.GetFirstFingerprint( _ID, _AccountsID, _DistrictStudentNbr, _FingerPrint)) // { // do // { // //textWLAppendText("Processing Account: " + _AccountsID.ToString()+ // // ", FP_Length = "+_FingerPrint.Length.ToString()+ "\n"); // textWL.AppendText(string.Format("Processing ID={0} Account: {1}, FP_Length = {2}\n", _ID, _AccountsID.ToString(), // _FingerPrint.Length)); // } // while (hfAccess.GetNextFingerprint(ref _ID, ref _AccountsID, ref _DistrictStudentNbr, ref _FingerPrint)); // //while (hfAccess.GetNextFingerprint( _ID, _AccountsID, _DistrictStudentNbr, _FingerPrint)); // } //} //catch (Exception ex) //{ // textWL.AppendText("Exception: " + ex.Message + "\n"); //} //hfAccess = null; // How to dispose? (Getting call stack error) } private void FormTest_Load(object sender, EventArgs e) { } private void buttonWL2_Click(object sender, EventArgs e) { // Test different methods of passing data from WinDev to C# clHFAccess wlTest = new clHFAccess(); textWL.Text = "Start of parameter test.\n"; int testInt = 0; byte[] testArray = new byte[20]; //wlTest.TestD(ref testInt,ref testArray); //textWL.AppendText(string.Format("Test D: testInt={0}, testArray upper bound={1}\n", testInt, testArray.GetLength(0))); wlTest.TestC(ref testInt, ref testArray); textWL.AppendText(string.Format("Test C: testInt={0}, testArray upper bound={1}\n", testInt, testArray.GetLength(0))); textWL.AppendText("End of test.\n"); wlTest = null; } } }