Announcement

Collapse
No announcement yet.

Default MAIL client launcher not working.

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

  • Default MAIL client launcher not working.

    The below finds the program and path via registery, but when I shell
    nothing happens

    #COMPILE EXE
    $INCLUDE "WIN32API.INC
    %REG_LEN = 1024
    DECLARE FUNCTION GetReg(BYVAL iLocation AS LONG, BYVAL sSubKeys AS STRING, BYVAL sValueName AS STRING, BYVAL sDefault AS STRING) AS STRING
    $programID = "TOSeM - Tired Of Spam eMail"

    FUNCTION PBMAIN() AS LONG
    LOCAL sName AS STRING, sMailClient AS STRING

    ' Get mail name...
    sName = GetReg(%HKEY_LOCAL_MACHINE, "SOFTWARE\Clients\Mail", "", "")
    sMailClient = GetReg(%HKEY_LOCAL_MACHINE, "SOFTWARE\Clients\Mail\" + sName + "\Protocols\mailto\shell\open\command", "", "")
    MSGBOX sName + " " + sMailClient
    ' If in quotes, then get whats inside the quotes...
    IF INSTR(sMailClient, CHR$(34)) THEN sMailClient = PARSE$(sMailClient, CHR$(34), 2)
    ' Execute mail client
    y!= SHELL (sMailClient, 1)

    END FUNCTION


    '------------------------------------------------------------------------------
    FUNCTION GetReg(BYVAL iLocation AS LONG, BYVAL sSubKeys AS STRING, BYVAL sValueName AS STRING, BYVAL sDefault AS STRING) AS STRING
    LOCAL hKey AS LONG, zRegVal AS ASCIIZ * %REG_LEN
    IF iLocation = 0 THEN iLocation = %HKEY_CURRENT_USER
    IF RegOpenKeyEx(iLocation, TRIM$(sSubKeys, "\"), 0, %KEY_READ, hKey) = %ERROR_SUCCESS THEN
    IF RegQueryValueEx(hKey, BYCOPY sValueName, 0, %REG_SZ, zRegVal, %REG_LEN) <> %ERROR_SUCCESS THEN GOTO RegStringDefault:
    ELSE
    RegStringDefault:
    zRegVal = sDefault
    END IF
    IF hKey THEN RegCloseKey hKey
    FUNCTION = zRegVal
    END FUNCTION

    ------------------

  • #2
    What happens if you just type the name of the mail client on the command line?
    --Don

    ------------------
    dickinson.basicguru.com
    Don Dickinson
    www.greatwebdivide.com

    Comment


    • #3
      Don..

      C:\PBCC20\mlocal>C:\Program Files\Netscape\Communicator\Program\netscape.exe "%1"

      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.

      I ADDED "" to go arouns the 8.3 filename/paths.. It loaded
      netscape. That is a plus.

      C:\PBCC20\mlocal>C:\"Program Files"\Netscape\"Communicator"\Program\netscape.exe "%1"

      C:\PBCC20\mlocal> (NETSCAPE BROWSER CAME UP)

      ------------------

      Comment


      • #4
        Actually, you can just keep it simple and quote the whole path, which is
        probably safer... I think many apps would be disconcerted to find quotes
        in the middle of a path spec. Try this:

        "C:\Program Files\Netscape\Communicator\Program\netscape.exe" "%1"


        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Thanks Tom.

          I will quote the whole string and let the OS parse it.

          I was unable to get Outlook to run, but I only had a second on the machine
          with outlook.

          Appears Netscape has there version of the path and IE theirs, but
          netscape works.

          Tomorrow I will get it working. Can not believe no one has a mail launcher,
          since there was launch browsers all over

          I started this a week ago or so. Had a program VNC that cause PBDLL
          to do a hourglass number, and a string with a missing quote that
          threw PBDLL for a loop as well. So it has been a slow start.

          Thanks again for you help.

          ------------------

          Comment

          Working...
          X