[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

OleInitialize function returns S_FALSE why?

Posted on 2000-01-23
3
Medium Priority
?
574 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:VBGuru
  • 2
3 Comments
 
LVL 6

Author Comment

by:VBGuru
ID: 2380394
Adjusted points to 100
0
 
LVL 2

Accepted Solution

by:
adityau earned 400 total points
ID: 2380411
Use OLEUnintialize before
Handle = OleInitialize(0)
0
 
LVL 6

Author Comment

by:VBGuru
ID: 2380419
ok, I think Vb is using this API before starting. Thanks anyway.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question