Announcement

Collapse
No announcement yet.

System Error - CoInitialize has not been called

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • System Error - CoInitialize has not been called

    Every time I try to call pb_Unload16 it fails (returns O) and causes VB 6.0 to GPF. Has anyone ever ssen this happen?

    Using Windows 98 SE...

    Regards,

    Jeffrey J. Borghoff
    609-306-6149
    [email protected]
    http://JeffreyJ.Borghoff.com

  • #2
    What operating system are you running? Windows 95, 98 or 98 SE?

    Which version of Visual Basic?

    Thanks!

    --Dave


    -------------
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      Windows 98 Second Edition. Visual Basic 6.0 Service Pack 3.
      Regards,

      Jeffrey J. Borghoff
      609-306-6149
      [email protected]
      http://JeffreyJ.Borghoff.com

      Comment


      • #4
        I get the same problem System Error &H800401F0(-2147221008) when executing
        in the VB60 Runtime environment. When running the compiled Vb exe application
        there is no problem.

        My VB60 code makes calls to the 16bit odbc.dll to extract/ update/ delete
        data on a Sybase database.

        I hope this code gives some indication of the process:-
        Code:
        '==============================================================================
        '   Routines for thunk to odbc 16 bit dll
        '
        '==============================================================================
        
        Public Type SQL32Call
             cConnect As String * 128
             InFile  As String * 128
             OutFile As String * 128
             ReqType As Long
        End Type
        
        Public Declare Function pb_Unload16 Lib "DM321632.DLL" (ByVal hDLL As Long) As Long
        Public Declare Function pb_Load16 Lib "DM321632.DLL" (ByVal dllName As String) As Long
        Public Declare Function pb_GetProc16 Lib "DM321632.DLL" (ByVal zDll As Long, ByVal zFunction As String) As Long
        Public Declare Sub dmSQL32call Lib "DM321632.DLL" Alias "pb_Call16" (ByVal hProc As Long, Rec As SQL32Call)
        
        Global ghDLL As Long
        Global pfnDTest As Long
        'Just for test
        'Global rec As String
        Global gConnect As String
        Global Const SQLInsert = 1
        Global Const SQLUpdate = 1
        Global Const SQLDelete = 1
        Global Const SQLSelect = 2
        Global Const SQLDataSources = 3
        Global gSQLCommandFile As String
        Global gSQLResultFile As String
        
        Sub Main()
            Dim s As Long
            gConnect = "ODBC;dsn=agencyG2;dbq=agencyG2;uid=morrisd;pwd=password;database=agencyG2"
            ghDLL = pb_Load16("dmodbc16.dll")
            pfnDTest = pb_GetProc16(ghDLL, "dmSQL32call")
            gSQLCommandFile = App.Path + "\" + "SQLIncmd.txt"
            gSQLResultFile = App.Path + "\" + "result.txt"
        
            Frm_Agnt.Show 1 'vbModal - this shows the extracted data for processing
            pb_Unload16 ghDLL '- This causes the System error in the VB runtime
                              ' but not with the compiled exe program 
        End Sub
        
        Function DoSQL(SQLfName$, SQLCmd$, OutFile$, _
                    dbConnect As String, SqlType As Long) As Long
        
            Dim fNo As Integer
            fNo = FreeFile
            Open SQLfName$ For Output As #fNo
            Print #fNo, SQLCmd$
            Close fNo
            If Exist(OutFile) Then
                  Kill OutFile
            End If
            Dim Req As SQL32Call
            Req.cConnect = dbConnect
            Req.InFile = SQLfName
            Req.OutFile = OutFile
            Req.ReqType = SqlType
        
            dmSQL32call pfnDTest, Req
        
            DoSQL = Req.ReqType
        
        End Function
        Last edited by Gary Beene; 12 Jul 2014, 08:38 PM. Reason: Code: tags

        Comment


        • #5
          I complied me code, and as stated it does not crash VB, altouugh, I checked the return code of pb_UnLoad16 and it returns 0 which according to the documentation is a failure. From Documenation: "success% is returned by pb_Unload16 and is nonzero if the DLL was unloaded from memory." I did check to see if the Driver DLL (DRV) I call in my PB/DLL DLL was still in memnoy via MSINFO and it appears it was unloaded...

          Any thoughts???
          Regards,

          Jeffrey J. Borghoff
          609-306-6149
          [email protected]
          http://JeffreyJ.Borghoff.com

          Comment


          • #6
            Is there going to be a fix for this PowerBASIC bug? Has anyone heard from PowerBASIC support?
            Regards,

            Jeffrey J. Borghoff
            609-306-6149
            [email protected]
            http://JeffreyJ.Borghoff.com

            Comment


            • #7
              According to my test, pb_Unload16 is not returning the correct value and you should either declare it as a Sub or ignore the return value.

              I have not been able to create a single test application that causes a "CoInitialize" error. As far as I can tell, that error has absolutely nothing to do with PB/DLL and must be caused by either VB or your code.

              --Dave


              -------------
              PowerBASIC Support
              mailto:[email protected][email protected]</A>

              Home of the BASIC Gurus
              www.basicguru.com

              Comment


              • #8
                It's good that you're not getting this problems on your side, but that does not mean the problem does not exist. At least three of your customers are having this problem, and it's critical! Let's not place the blame or pass the buck to Microsoft Visual Basic. Work with Microsoft and your customers who are having this problem to identify and fix it. You told me that this problem seems to be appearing in VB 6.0 Service Pack 3, that's a good place to start. I would be happy to assist you in any way to solve the problem.

                Regards,

                Jeffrey J. Borghoff
                609-306-6149
                [email protected]
                http://JeffreyJ.Borghoff.com

                Comment


                • #9
                  Jeff,

                  Three out of thousands of customers. Yeah, that definitely points to a problem in PowerBASIC...

                  Let's get something perfectly straight. I am most definitely interested in helping you get to the bottom of this problem. In the *very remote* possibility that this is a problem with Direct/32, we most assuredly want to get it fixed.

                  My tests indicate that no such problem exists in our product. What I need from you is a small sample program that definitively demonstrates the problem. Once I have that, I can verify what's causing the problem, and if it's in our product, I can get it immediately fixed.

                  If you can't re-create the problem in a small test application, then it's very likely that (as I suspect) the problem is in your code. If you are still unconvinced, I can arrange to have your application debugged on our end, but if we discover that it is a problem with your code, we'll have to charge you for our services.

                  To make a long story short, if you help me, I'll help you. I am **very** interested in finding out what's causing the problem. Please email me something that will help me.

                  Thanks!

                  --Dave


                  -------------
                  PowerBASIC Support
                  mailto:[email protected][email protected]</A>

                  Home of the BASIC Gurus
                  www.basicguru.com

                  Comment


                  • #10
                    As I have stated already this is a problem that exists in the UNTOUCHED sample code that came with PowerBASIC. On my PC running Windows 98 SE With VB60 SP3 I will compile your ADDONE sample app. and send to you.

                    Have you raised this issue to Microsoft Visual Basic Tech Support?

                    I would like to keep this dissucssion friendly. I'm not looking to place blame or point fingers, and I would like to retract any reference to this being a bug in PowerBASIC. I just would like to see this issue resolved, and keep the dialog friendly.
                    Regards,

                    Jeffrey J. Borghoff
                    609-306-6149
                    [email protected]
                    http://JeffreyJ.Borghoff.com

                    Comment


                    • #11
                      I don't know if this is of any use... http://support.microsoft.com/support.../Q186/0/63.ASP

                      A search of www.deja.com gives 21 results on this VB error message, almost all dealing with MS-Exchange... http://bx6.deja.com/qs.xp?OP=dnquery...server&test=PS
                      -------------
                      Lance
                      PowerBASIC Support
                      ( mailto:[email protected][email protected]</A> )
                      Lance
                      mailto:[email protected]

                      Comment


                      • #12
                        Thanks for looking. I've contacted Microsoft VB Support. They have created a Microsoft Support Case Number: SRX991216601575. It appears that this is an OLE Automation error that occurs in the VB IDE.
                        Regards,

                        Jeffrey J. Borghoff
                        609-306-6149
                        [email protected]
                        http://JeffreyJ.Borghoff.com

                        Comment


                        • #13
                          I responded to George's message. As I told him, DIRECT32.DLL does absolutely nothing with OLE or any of the VB runtime modules. It simply calls QT_Thunk and the WOWVDM* functions to pass data between the 32-bit app and the 16-bit app.

                          And I ran the Direct/32 sample from PB/DLL 2.0 in VB 6.0 on my Windows NT machine and got no error. I have no installed the latest hotfix for VB, I'll do that today and see what happends.

                          --Dave


                          -------------
                          PowerBASIC Support
                          mailto:[email protected][email protected]</A>

                          Home of the BASIC Gurus
                          www.basicguru.com

                          Comment


                          • #14
                            A suggestion:

                            Try to see if the problem disappears, if you go back to a previous Service Pack.

                            I am not crazy about VB Service packs since for every bug MS fixes, they introduce new ones.

                            ie. I have VB 5.0 Professional. It worked fined. I installed Service Pack 3 and now VB GPFs when it compiles a program to Native code (doesn't with PCode). This does not give me reason to have confidence in VB Service Packs.

                            I would test out your code on the original VB 6, and then each service Pack and see at what point the problem appears.

                            You also should check out your OLE DLLs. MS sneekily keeps updating the OS DLLs with each new version of Internet Explorer. There are a bunch of different versions of OS DLLs floating around.

                            Chris Boss
                            Computer Workshop
                            Developer of "EZGUI"
                            http://cwsof.com
                            http://twitter.com/EZGUIProGuy

                            Comment


                            • #15
                              Dave, Any chance you can test that on Windows 98 Second Edition? Manual states: "Because Windows NT does not share address space between
                              16-bit and 32-bit processes, Direct/32 will work only in Windows 95.", correct?


                              [This message has been edited by Jeffrey J. Borghoff (edited December 17, 1999).]
                              Regards,

                              Jeffrey J. Borghoff
                              609-306-6149
                              [email protected]
                              http://JeffreyJ.Borghoff.com

                              Comment


                              • #16
                                My mistake in my post... You can't use Direct/32 in Windows NT. I have a Windows 98 Second Edition machine set up on my switchbox which is where I am doing my testing.

                                I built this machine only two weeks ago with the latest Win98SE version supplied with MSDN, so I am condifent that it's the latest version of Win98.

                                However, as I mentioned, I don't have the latest service pack installed for VB6. The CD I installed VB6 from says "Visual Basic 6.0, Service Pack 1" on it. I don't have a CD with service pack 3, so I'll download it from the Microsoft site.

                                I also have a Win98 machine at home (not SE, it's the original release). I'll take a floppy home and try the code there too.

                                You were the first person to actually contact Tech Support about this problem. And given how recently SP3 was released, I wouldn't be surprised if the problem is in SP3 given that Direct/32 hasn't changed in three years.

                                That doesn't mean we might not be able to come up with some kind of work around for you, but I am very confident that the problem is not a bug in Direct/32.

                                --Dave


                                -------------
                                PowerBASIC Support
                                mailto:[email protected][email protected]</A>

                                Home of the BASIC Gurus
                                www.basicguru.com

                                Comment


                                • #17
                                  Dave, at this point speaking with MS Tech Support I tend to agree with you. I don't think it is PB/DLL Direct/32, it appears to be in VB IDE, however I have never seen this problem in VB, looks like Direct/32 may have uncovered something. Eager to see a resolution. Thanks for your support...
                                  Regards,

                                  Jeffrey J. Borghoff
                                  609-306-6149
                                  [email protected]
                                  http://JeffreyJ.Borghoff.com

                                  Comment


                                  • #18
                                    Dave,

                                    Any status on this issue? How have your tests on Windows 98SE and VB6.0 SP3 gone?
                                    Regards,

                                    Jeffrey J. Borghoff
                                    609-306-6149
                                    [email protected]
                                    http://JeffreyJ.Borghoff.com

                                    Comment


                                    • #19
                                      I've emailed PB/DLL 2.0 and my results to George at Microsoft. We'll see what he comes up with.

                                      --Dave


                                      -------------
                                      PowerBASIC Support
                                      mailto:[email protected][email protected]</A>

                                      Home of the BASIC Gurus
                                      www.basicguru.com

                                      Comment


                                      • #20
                                        I am still very much interested in the progress on this research.

                                        My compiled VB programs on Win95/98, using direct32.dll to link to the
                                        odbc16.dll, are performing ok.

                                        When trying to run in the VB6 IDE, they can "spit the dummy" with
                                        "System Error &H800401F0(-2147221008)". This makes development a bit of
                                        a pain.

                                        I look forward to Dave's next posting after MS respond.

                                        Comment

                                        Working...
                                        X