Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 10th June 2002, 22:58
Ruskin's Avatar
Ruskin Ruskin is offline
Unconfirmed User
 
Join Date: Feb 2002
Location: New Zealand
Posts: 91
Ruskin is on a distinguished road
Baan: All - DB: MS-SQL, Informix, Oracle - OS: UNIX and NT Server
Wink 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.
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...
Attached Files
File Type: txt vb_tip.txt (10.2 KB, 468 views)

Last edited by ~Vamsi : 11th June 2002 at 01:02.
Reply With Quote
  #2  
Old 10th June 2002, 23:20
Ruskin's Avatar
Ruskin Ruskin is offline
Unconfirmed User
 
Join Date: Feb 2002
Location: New Zealand
Posts: 91
Ruskin is on a distinguished road
Baan: All - DB: MS-SQL, Informix, Oracle - OS: UNIX and NT Server
TIP....

The code, in this utility, indicates a sequential read of the BWC file to write the records to a temporary BWC file and then overwrite the original (ie: if the original BWC is CONFIG.BWC, this code writes the records to TEMP.BWC, with the new 'command' setting, then overwrites CONFIG.BWC with TEMP.BWC). This is not necessarily the best way to achieve this. The BWC file is maintained in the same way INI files are, with;
[Application]
Key=Value
As a result, the following lines could be used in place of the 'RebuildConfigFile' function;

in the General Declarations section;
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

replacing the 'RebuildConfigFile' function call with;
x = WritePrivateProfileString("ApplicationServer", "command", Trim(rbDLLName) & " " & rbParameters, rbConfigFile)
Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
API Handler accessing baan sessions outside baan vishbaan Open World, Portal & Decision Manager 2 9th July 2003 07:42
BaaN OLE Automation I.Benini AFS/DDC/OLE: Function servers 1 10th October 2002 16:04
Baan World Users conference in Orlando chadwickh General Discussion & Chat 7 3rd November 2001 21:55
Availability of Web-Based DEM (Baan Press Release) Pierre B. General Discussion & Chat 0 5th September 2001 05:59
BSP-US (LLC) added as a Baan Education Alliance svandenh General Discussion & Chat 1 20th August 2001 19:44


All times are GMT +2. The time now is 11:36.


©2001-2017 - Baanboard.com - Baanforums.com