pedromrs
23rd October 2002, 18:08
Hi,

After reading the forum and studying the alternatives I decided to go for OLE/STPAPI instead of the C interface.

I have been able to use the employers session (tccom0101m000)with VB code.
Now I have a problem, what is the correct way to close the object?

I use

BaanObject.Quit()
BaanObject = Nothing

The program goes trough this lines cleanly. Problem is it doesn't close the Bann Options window so I assume the object is not being cleaned in a good fashion.
Is this true?
BTW, is there a way to hide the options window in the BWC?
Also can the BAAN Ole use a specific BWC (registry setting maybe)?

Last question (promise). Is there a way to expose the all the methods and properties of the OLE interface or is there a document about it?

Thanks in advance :)

Al Smith
23rd October 2002, 19:20
Hi,
The quit command is BaanObj.Quit without the parenthesis.

I've seen different ways of using specific BWC's for the Ole.
The way I do it is with the registry setting for LocalServer32.

LocalServer32 = c:\baan\bin\bw.exe /Web2Baan.bwc

Then in the bwc I have the command set to:
command=/Automation

The code below will hide the "Option Dialog".

Dim BaanObj As Baan4.Baan4

Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Sub Main()
Set BaanObj = CreateObject("Baan4.Application")

' Hide Option Dialog
ShowWindow FindWindow(vbNullString, "Option Dialog"), SW_HIDE

' Your BaanObj code

' Restores Option Dialog if you want.
ShowWindow FindWindow(vbNullString, "Option Dialog"), SW_SHOWMINIMIZED

BaanObj.Quit
Set BaanObj = Nothing
End Sub

pedromrs
23rd October 2002, 20:42
Hi Al,

Thanks for the quick reply.
I use the parenthesis because I'm working with VB .NET, it's mandatory. (I'm glad it is because I'm used to C,C#.)

Thanks.