bizen99
15th October 2002, 17:32
Hi,

Is there any way to not show 'Option Dialog' when I use 'OLE Functions'?

Thanks
Bizen

mark_h
15th October 2002, 21:01
There is not a way that I know of to make the option dialog disappear or be invisible. Maybe there is a windows method of keeping it from appearing on the task bar, but that is beyond me.
Maybe someone else knows a solution.

Mark

gfasbender
15th October 2002, 21:33
bizen99,

I've never seen a solution for this either.

Can you keep it from displaying when starting a BW client? There should be no difference.

Al Smith
16th October 2002, 20:08
Hi,
I haven't found a way to affect the "Option Dialog" directly but with VB you can affect the taskbar as a whole.

The easiest way is if your application has a form, set the form's border style to none and the WindowState to Maximized. This will fill the screen, covering the taskbar. The drawbacks are you need a form and you loose the caption bar along with the mix, max and close buttons.

There are also API calls that can Disable the taskbar or Hide the taskbar. These can be used if your application doesn't have a form or if you dont want to eliminate the caption bar etc. (See Below)

Al.

Disable Task Bar
'******* Disable Task Bar ************
'Create a form with 2 command buttons.
'*************************************
Option Explicit

Dim BaanObj As Baan4.Baan4

Private Const strTaskBar As String = "Shell_traywnd"
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long

Public Sub DisableTaskBar()
Dim lngTaskBarHwnd As Long
'Find the Taskbar's hwnd
lngTaskBarHwnd = FindWindow(strTaskBar, "")
Call EnableWindow(lngTaskBarHwnd, 0)

Set BaanObj = CreateObject("Baan4.Application")

End Sub

Public Sub EnableTaskbar()
Dim lngTaskBarHwnd As Long
'Find the Taskbar's hwnd
lngTaskBarHwnd = FindWindow(strTaskBar, "")
Call EnableWindow(lngTaskBarHwnd, 1)

BaanObj.Quit
Set BaanObj = Nothing

End Sub


Sub Command1_Click()
DisableTaskBar
End Sub

Sub Command2_Click()
EnableTaskbar
End Sub

Hide Task Bar
'*********** Hide Task Bar ***********
'Create a form with 2 command buttons.
'*************************************


Dim BaanObj As Baan4.Baan4

Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40

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

Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

Sub Command1_Click()
Dim Thwnd As Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)

Set BaanObj = CreateObject("Baan4.Application")

End Sub

Sub Command2_Click()
Dim Thwnd As Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)

BaanObj.Quit
Set BaanObj = Nothing

End Sub

Al Smith
17th October 2002, 21:46
Hi again,

Here's some VB code that will hide the "Option Dialog" when using OLE.

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