Announcement

Collapse
No announcement yet.

hMailServer Com code

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

  • hMailServer Com code

    I'm trying to convert this code from VB Script to PB Win. I get an Error 99 as noted in the code. I can not figure out what is wrong. Can someone point me in the right direction.

    Thanks


    VB Script Code
    Code:
    #IF 0
       ' Working vbScript
      
      OPTION EXPLICIT
      CONST sAdminPassword = "password"
      DIM oApp
      SET oApp = CreateObject("hMailServer.Application")
    
       ' Authenticate the client.
      CALL oApp.Authenticate ("Administrator", sAdminPassword)
    
      MSGBOX oApp.Version, 0, "Server Version"
      MSGBOX oApp.Status.StartTime, 0, "Server Start Time"
    
    #ENDIF
    PB Win 9.01 code
    Code:
    #COMPILE EXE
    #DIM ALL
    #DEBUG DISPLAY ON
    #INCLUDE "hMailServer.inc"
    
    FUNCTION PBMAIN () AS LONG
      #DEBUG CODE ON
      DIM oServer AS IInterfaceApplication
      DIM sAdminPwd AS STRING
      sAdminPwd = INPUTBOX$("Enter administrator password", "hMailServer")
    
      LET oServer = NEWCOM $PROGID_hMailServer_Application
      IF ISOBJECT(oServer) THEN
        oServer.Authenticate ("Administrator", sAdminPwd)
        ? ACODE$(oServer.Version)
        ' PBWin 9.01 reports Error 99 on the next line.
        ? ACODE$(oServer.Status.StartTime)
    
      END IF
      
      LET oServer = NOTHING
      #DEBUG CODE OFF
    
    END FUNCTION
    Attached Files
    --
    Doug

  • #2
    Code:
    oServer.Authenticate ("Administrator", sAdminPwd)
    must be:

    Code:
    oServer.Authenticate (UCODE$("Administrator"), UCODE$(sAdminPwd))
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Thank you!

      I don't know what I was thinking :dang: I converted the strings coming out.
      --
      Doug

      Comment


      • #4
        http://www.hmailserver.com
        Looks interesting!
        CMD shortcut to open any location:
        %windir%\system32\cmd.exe /k " cd\ & x: & cd x:\xxxx
        Change to run as administrator
        How long is an idea? Write it down.

        Comment


        • #5
          note for anyone else testing, if you are getting error 5 then:
          remove chr$(0)
          ie. replace
          ? oServer.Version
          with
          ? REMOVE$(oServer.Version,CHR$(0))

          Originally posted by Mike Doty View Post
          http://www.hmailserver.com
          Looks interesting!
          Great little mail server, I use it with Roundcube for webmail

          Doug, will you post your samples when done ??

          N.
          Last edited by Neil J Hosgood; 17 Apr 2009, 04:54 AM.

          Comment

          Working...
          X