Ruskin
10th June 2002, 05:01
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 couple of text files, 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.
eg: CreateObject("Baan4.Application.B4_Config")
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;
CreateObject("Baan4.Application")
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>)
eg:
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...
eg: CreateObject("Baan4.Application.B4_Config")
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;
CreateObject("Baan4.Application")
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>)
eg:
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...