Tip for activating Baan from VB (non-OLE)
Firstly; this posting was originally on the 'Tools Development' board, but should have been on the 'Code and Utilities Forum', so is a copy of the same posting from the development board.
There has been some discussion on using OLE to activate a Baan object and call a Baan DLL. I have also had some questions, on activating Baan sessions and objects, via Visual Basic where OLE is not suitable. As a result, I have decided to post a text file, that people may find useful. I must stress, that this may NOT be the best way to activate your Baan object and I am not attempting to tell you not to use OLE (which has advantages over this method), but there are some cases, where this code is more useful. A common instance, where you would want to use this method, is if you do not have the appropriate BWC file registered on each computer, thus using OLE will not work when you try to use the 'CreateObject' VB function.
Will only work if the B4_Config BWC file is correctly registered on the client PC. However, this is not always the case, thus activating the B4_Config BWC file, must be performed via a different method, other than OLE. You could still use OLE to activate the B4_Config BWC file, but you would have to do;
Then hope like hell, that your user selects the correct config file (bit dangerous for some users).
The method I have used, is to activate the BW executable, with a configuration file. The configuration file, then activates a 3GL Baan programme (in the command setting) passing parameters, which are then read by the argv$() Baan function. The example files allow you to use a VB front end to manipulate activities attached to a project and call the BWC file to rebuild the activities, for the given project.
The vb_tip.txt file contains the VB code used to activate the BWC file. NOTE: this code automatically determines where BW.EXE is installed (on the local PC) and will activate the BWC file and stay in a loop until the programme is shut down. This is called by;
RunBaanDLL(<3 GL Programme>, <BWC File>, <Parameters For DLL> )
RunBaanDLL("otccomprog", "B4_CONFIG.BWC", "parm1 parm2 parm3")
The vb_tip.txt file, also contains the Baan code for the 3GL programme, to read the passed parameters and perform whatever Baan functions are needed, such as activating another DLL, or running queries/updates, etc.
Hope this is of some help...
Last edited by ~Vamsi : 11th June 2002 at 02:02.