Announcement

Collapse
No announcement yet.

OBJECT CALL - err 99

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

  • OBJECT CALL - err 99

    Hi all,

    has anyonbe an idea why this does return an OBJRETURN value of
    -2147352567 while calling the method of the object?

    The original code was posted by Robert Mantovan but did not run either...

    ------------------------------------------------------------------------------
    #DIM ALL
    #COMPILE EXE "VIENNA"
    #INCLUDE "domino.inc"
    #INCLUDE "win32api.inc"

    '------------------------------------------------------------------------------
    ' Lotus Notes COM Sample to run a server console command
    '------------------------------------------------------------------------------

    FUNCTION PBMAIN
    CHDIR "\DOMINO"
    ' Object Variables
    DIM oSession AS LotusNotesSession
    DIM vServer AS VARIANT
    DIM vCommand AS VARIANT
    DIM vReturn AS VARIANT
    DIM vPassword AS VARIANT

    DIM A AS ASCIIZ * 1024

    ' Open an instance of Lotus Notes
    SET oSession = NEW LotusNotesSession IN "Lotus.NotesSession.7.0"
    IF ISFALSE ISOBJECT(oSession) OR ERR THEN
    MSGBOX "Notes could not be opened - Check notes.ini and directories."
    EXIT FUNCTION
    END IF

    'Send Console Command
    LET vServer = "DOMINO1"
    LET vCommand = "sh stat"
    LET vPassword = "adelaide"
    OBJECT CALL oSession.Initialize(vPassword)
    OBJECT CALL oSession.SendConsoleCommand(vServer, vCommand) TO vReturn
    MSGBOX VARIANT$(vReturn)
    MSGBOX STR$(OBJRESULT)
    SET oSession = NOTHING
    END FUNCTION
    Last edited by Thomas Udo Eichler; 23 Oct 2007, 11:44 AM. Reason: just to be complete ...
    Consistency is the last refuge of the unimaginative.
    Oscar Wilde

  • #2
    Is it possible that the Session.Initialize is what is erroring out?

    Try
    OBJECT CALL oSession.Initialize(vPassword)
    MSGBOX STR$(OBJRESULT)
    OBJECT CALL oSession.SendConsoleCommand(vServer, vCommand) TO vReturn
    MSGBOX STR$(OBJRESULT)

    Just to see is intialize is working. Secondly I believe that
    "Notes.XXX" is for early binding
    "Lotus.XXX" is for late binding

    Also make sure that
    "Lotus.NotesSession.7.0" is what you are supposed to be calling
    or
    "Lotus.NotesSession" (should be this one)
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

    Comment


    • #3
      Initialize also fails

      Hi Thomas,

      thanks for your hints! The initialization as an OBJECT CALL xxx.yyy does not work either. The Debugger shows an ERR 99 and the OBJRESULT gives the same number for all of these calls.

      I made a copy of the Domino.inc to show ProgID & Interface
      ' ------------------------------------------------------------
      ' Library Name: Lotus Domino Objects 1.2
      ' Library File: C:\notes\domobj.tlb
      ' ------------------------------------------------------------
      ' ProgID: Lotus.NotesSession.7.0
      ' Interface Name: LotusNotesSession
      '
      ' Interface Prefix: Lotus
      ' ------------------------------------------------------------
      $PROGID_LotusNotesSession70 = "Lotus.NotesSession.7.0"

      The include file was created with the com browser in PBWIN80. I suppose it must have to do with the call itself. Any more ideas ?
      Consistency is the last refuge of the unimaginative.
      Oscar Wilde

      Comment


      • #4
        Try
        SET oSession = NEW LotusNotesSession IN "Lotus.NotesSession"

        or

        SET oSession = NEW LotusNotesSession IN "Notes.NotesSession.7.0"

        or

        SET oSession = NEW LotusNotesSession IN "Notes.NotesSession"

        If none of these work then look in the registry for Lotus.NotesSession in HK Classes Root for Lotus. or Notes. and see if they exist. My bet is either the names do not exist or may be an automation type not supported by PB.
        Sr. Software Development Engineer and Sr. Information Security Analyst,
        CEH, Digital Forensic Examiner

        Comment


        • #5
          ... all three did no work...
          The failure must be in the somewhere else ...
          Consistency is the last refuge of the unimaginative.
          Oscar Wilde

          Comment


          • #6
            Were you able to check the registry to see if the classes you are calling do exist there? It really sounds like the Automation Type is not supported. Another way to check this would be to do the same thing in VB Script.

            Try this in a VBS File
            Code:
            '--------------------------------------------------------------------
            On Error Resume Next
            Dim oSession 
            Dim sServer
            Dim sCommand
            Dim sPassword
            Dim oReturn
            
            sServer = "DOMINO1"
            sCommand = "sh stat"
            sPassword = "adelaide"
            
            Set oSession = CreateObject("Lotus.NotesSession")
            If oSession is nothing then
                   Msgbox "Couldnt create session object"
            else
                   oSession.Initialize(Cstr(sPassword))
                   if err then
                        Msgbox Err.Description
                   else
                        oReturn = oSession.SendConsoleCommand(CStr(sServer), Cstr(sCommand))
                        Msgbox oReturn
                   End if
            End if
            Give that a go, if it doesnt work Remove the CSTR() that wraps the strings and see if that doesnt help.
            Sr. Software Development Engineer and Sr. Information Security Analyst,
            CEH, Digital Forensic Examiner

            Comment


            • #7
              Thank you Thomas for your help!

              the vbs worked fine so I suppose the classes are installed correctly. It seems my PBWIN code has another problem. Even if the initialization does not succeed.

              Maybe you have another idea about that ?

              Thanks in advance !
              Consistency is the last refuge of the unimaginative.
              Oscar Wilde

              Comment


              • #8
                If the vb script worked fine then the classes are installed correctly. Did the vbs code work with the CSTR() and without? There must be an issue with early vs late binding.

                Try this

                Code:
                #Compile Exe
                #Include "Win32Api.Inc"
                
                
                Function PBMain
                    '-----------------------------------------------------------------------
                    'Author :   <your name here>
                    'Purpose:   Main Entry Point into application
                    'Date   :   <todays date>
                    '-----------------------------------------------------------------------
                    Dim oSession As Dispatch
                    Dim sServer As String
                    Dim sCommand As String
                    Dim sPassword As String
                    Dim vReturn As Variant
                    Dim vServer As Variant
                    Dim vCommand As Variant
                    Dim vPassword As Variant
                
                    sServer = "DOMINO1"
                    sCommand = "sh stat"
                    sPassword = "adelaide"
                
                    Let vServer = sServer
                    Let vCommand = sCommand
                    Let vPassword = sPassword
                
                    
                    Set oSession = New Dispatch In "Lotus.NotesSession"
                    If IsFalse(IsObject(oSession)) Or Err Then
                       MsgBox "Couldnt Create Object"
                       Exit Function
                    Else
                       Object Call oSession.Initialize(vPassword)
                       MsgBox Str$(ObjResult)
                       Object Call oSession.SendConsoleCommand(vServer, vCommand) To vReturn
                       MsgBox Str$(ObjResult)
                    End If
                    Set oSession = Nothing
                
                End Function
                Sr. Software Development Engineer and Sr. Information Security Analyst,
                CEH, Digital Forensic Examiner

                Comment


                • #9
                  If the last set of code posted by Thomas Tierney does not work on your system, send me an email if the version of your OS is Windows NT or greater. I have a component that might help you track down the problem.
                  The code posted by Thomas Tierney does work.
                  Dominic Mitchell
                  Phoenix Visual Designer
                  http://www.phnxthunder.com

                  Comment


                  • #10
                    Thanks for your help

                    Hi folks,

                    the code Thomas has published works fine. What I was not aware is, that the COM interface does not allow to specify a dedicated Notes environment. That for it would be necessary to user real CPP Notes API. Otherwise the notes.ini to be used cannot be specified. The COM interface works fine for backend tools but can as far as I could see not be used to create for instance a server addin. So my search con tinues here....

                    But for all, it helped alot to getg at least a piece of code running and to make experiences with the COM interface.

                    Many thanks, best regards & cheers,

                    Thomas
                    Consistency is the last refuge of the unimaginative.
                    Oscar Wilde

                    Comment

                    Working...
                    X