Link to home
Start Free TrialLog in
Avatar of VBGuru
VBGuruFlag for India

asked on

OleInitialize function returns S_FALSE why?

With the following piece of code OleInitialize function is always returning 1. I want to know, what I am missing out here. In VC++ it retuns 0.


Option Explicit
Private Const S_OK As Long = 0
Private Const S_FALSE As Long = 1

Private Declare Function OleInitialize Lib "ole32.dll" (ByVal pvReserved As Long) As Long
Private Declare Sub OleUninitialize Lib "ole32.dll" ()

Private Sub Form_Click()
Dim Handle As Long

Handle = OleInitialize(0)
Select Case Handle
    Case S_OK
        MsgBox "The library was initialized successfully."
    Case S_FALSE
        MsgBox "The OLE library is already initialized"
End Select
OleUninitialize
End Sub
Avatar of VBGuru
VBGuru
Flag of India image

ASKER

Adjusted points to 100
ASKER CERTIFIED SOLUTION
Avatar of adityau
adityau

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VBGuru

ASKER

ok, I think Vb is using this API before starting. Thanks anyway.