What am I missing? ->:C/Front

Hello everybody. I really hope someone can help me with this. I’ve tried long enough myself… The following sample I wrote in Visual C++ 6.0. I want to make the Customer Table visible with a Tree View. The compiler doesn’t give any warning or error, but everytime I try to run my program, a general protection fault occurs. What am I doing wrong? void CTreeExView::OnInitialUpdate() { CTreeView::OnInitialUpdate(); CTreeCtrl& tree = GetTreeCtrl(); long TabelNummer,AantalVelden,Record,AantalRecords; TabelNummer=18; long* hTabel=0; LPCTSTR dnaam=“C:\Program Files\Navision Financials\database.fdb”; CCFRONT* CF= new CCFRONT; CF->OpenDatabase(dnaam,(long)500,true); CF->OpenCompany(“CRONUS Nederland BV”); CF->OpenTable(hTabel,TabelNummer); AantalVelden=CF->FieldCount(*hTabel); HTREEITEM hChapter = tree.InsertItem(“Klant”); CF->FindRec(*hTabel,Record,"-"); AantalRecords=CF->RecCount(*hTabel); for (int i=1; i<= AantalRecords;i++) { tree.InsertItem((CF->FieldName(*hTabel,1)), hChapter); CF->NextRec(*hTabel,Record,1); } CF->FreeRec(Record); CF->CloseTable(*hTabel); CF->CloseCompany(); CF->CloseDatabase(); delete CF; } Thanks. Anolis Sittard Netherlands

You need AllocRecord. Add : Record = CF->AllocRec(hTabel); After: CF->OpenTable(hTabel,TabelNummer);

Hello db Thanks for your reply, but still no luck. I tried it before, and I tried it again, the compiler still doesn’t give any errors or warinings(with or without the ‘AllocRec’), and the system still crashes. Anolis Sittard Netherlands

OK, There some misstakes: long hTabel=0; //you setting hTable val addr = 0, val not allocated CF->OpenTable(&hTabel,TabelNummer); AantalVelden=CF->FieldCount(hTabel); …change everywhere do the same with hRec

Hello ‘db’! Stil no luck. I rewrote the whole thing, and this tiome it works! I made m_cfront a variable of the type CCFRONT. long TabelNummer,AantalVelden,Record,AantalRecords; TabelNummer=18; long hTabel; LPCTSTR dnaam=“C:\Program Files\Navision Financials\database.fdb”; m_cfront.OpenDatabase(dnaam,500,1); m_cfront.OpenCompany(“CRONUS Nederland BV”); m_cfront.OpenTable(&hTabel,TabelNummer); AantalVelden=m_cfront.FieldCount(hTabel); Record=m_cfront.AllocRec(hTabel); HTREEITEM hChapter = m_tree.InsertItem(“Klant”); m_cfront.FindRec(hTabel,Record,"-"); AantalRecords=m_cfront.RecCount(hTabel); for (int i=1; i<= AantalRecords;i++) { m_tree.InsertItem(m_cfront.FieldToStr(hTabel,Record,2), hChapter); m_cfront.NextRec(hTabel,Record,1); } m_cfront.FreeRec(Record); m_cfront.CloseTable(hTabel); m_cfront.CloseCompany(); m_cfront.CloseDatabase(); It was this thing with the pointers an references that caused all the errors, just like you said. Thank you very much for thinking with me, even while all variable names were in dutch. Anolis Sittard Netherlands

How do you register, and use the Cside.dll in Visual C++ ? Do you use the Class Wizard and register ist over the new automation. I read in the manuell: To initialize the library and configure the environment, call DBL_Init. This function initializes internal data structures, creates buffers, and loads the dynamic link libraries required by the library. But i dont know how to regist/use this libary ! Could you please help me !? ------------ Best regards Alejandro Schubert alejandro.schubert@cycos.com

Try the sample file that comes with C/FRONT: sample.c This uses a file, called Libload.c (comes also with C/FRONT). I think db can help you better, since I usually use Borland C++ Builder, which works completaly different than Visual C++. Anolis Sittard Netherlands

Cside.dll ??? What is it ? If talking about cfront.dll, include libload.c. Or you can load dll, by self using LoadLibrary and GetProcAddr. Look at libload.c If this dll (cfront.ocx) is autometed you can use ClassWizard.