Results 1 to 7 of 7
  1. #1
    trevorforster
    Guest

    Decoding e-mail attachments (VB6)

    I am developing an existing Access7/VB6 app to utilise the e-mail functionality of OfficeTalk via that product's API. I can decode attachments in Word and Excel by creating a Word/Excel object and using appropriate VB code. I imagine there must be some standard code which recognises the software from which the attachment was created and then does the necessary. However, I cannot find any reference to this code on the Microsoft website. Please, can anyone help?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Decoding e-mail attachments (VB6)

    Trevor,

    You are a little short on the details. Give us more to work with here... What the heck are you trying to do?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Decoding e-mail attachments (VB6)

    As you may recall from playing around in the File Types dialog (accessible from the View or Tools menu of Windows Explorer under Folder Options or Options, depending on version), Windows recognizes applications from the file extension; I don't think there is any other reliable method. This data is stored in the registry under "classes." If you query

    HKEY_CLASSES_ROOT.doc

    for example, you get the default value:

    Word.Document.8

    and the potentially helpful indication that Content Type = application/msword.

    You then query for:

    HKEY_CLASSES_ROOTWord.Document.8shell

    to retrieve the default action, which happens to be Open, and then query for:

    HKEY_CLASSES_ROOTWord.Document.8shellOpencommand

    and retrieve the default value:

    "D:MSOfficeOfficeWINWORD.EXE" /n

    (which is idiosyncratic to the queried system). Is that what you want?

    You can do these queries from the PrivateProfileString method of the System object in the Word object model, or using WinAPI. I don't have any working sample of this, but hopefully the above will be enough to get a start on it.

  4. #4
    trevorforster
    Guest

    Re: Decoding e-mail attachments (VB6)

    Thanks for the response, Kevin, and apologies for the brevity of the question. This is my first attempt at "lounging". Hope this clarifies further:
    The OficeTalk API allows me to call functions which create attachments to messages, and also create a decoded version of that message in a specified directory. I then need some VB code which will allow me to open file.xxx in that directory, whatever the originating software. Is that any clearer?

    Thanks

  5. #5
    trevorforster
    Guest

    Re: Decoding e-mail attachments (VB6)

    Thanks jscher2000. I'll see what I can do with it.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Decoding e-mail attachments (VB6)

    >>VB code which will allow me to open file.xxx in that directory, whatever the originating software.

    I think I can just barely see the outline of a polar bear in the snow drift. Maybe Jefferson figured out what you want: he's pointing you to the Windows file associations so that, for example, if you d-click an attachment the program associated with the file extension will launch and open that file.

    That doesn't require any VB code to set up.

    What are the possible .XXX file extensions you are dealing with? What's the file format of the decoded messages, ASCII text? Do you need code that opens text files? Will the code open the files or is Jefferson on to something: you want VB code to create the file associations. Maybe that's it!?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    trevorforster
    Guest

    Re: Decoding e-mail attachments (VB6)

    Hi Kevin,

    I want to achieve the same effect as a d-click on an attachment as you suggest, but don't have an attachment to click on.

    The API gives me access to the name of the encoded file, but only as a string held in their Access database. Thro' API code, I can decrypt that file to a directory where I can then open it from within our Access database. I'm trying to work out how to effectively d-click that file in that directory from within Access. I assume I have to do that programmatically, and Jefferson has shown me where the data is held. I now have to understand how to access that registry file and utilise the data held therein.

    Regarding the type of file, it could be anything someone might send as an attachment., so I'm looking for a generic approach, as suggested by Jefferson, rather than writing code to cover a finite number of possibilities.

    If the bear is any more distinct now, I would value any further guidance you could give me.

    Thanks

    Trevor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •