Announcement

Collapse
No announcement yet.

%Unicode and SocketTools SendMail Sample

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

  • %Unicode and SocketTools SendMail Sample

    I've installed the evaluation version of SocketTools Library Edition and wouldn't you know it, I'm having trouble with the very first sample application of theirs I tried, SendMail,

    I added "%Unicode=1" before the include declarations and when I run the program I get an "Out of Memory" error. I tried it with the PowerBASIC includes and with Jose's includes - same result.

    If I remove "%Unicode=1" the sample application works just fine.

    The SocketTools include file takes into %Unicode into account, similar to how the PowerBASIC includes handle it.

    Except for these few lines, the sample app does little more than fill up a couple of structures which are passed to a SocketTools API. So I might expect the issue to be here, but it's not clear to me if these lines are at fault Just for grins, I tried upping the allocation of textMessage() but that did not change the results.

    Code:
        ' Copy the message text into the buffer
        Control Send hDlg, %IDC_MESSAGE, %WM_GETTEXTLENGTH, 0, 0 To nLength
        Dim textMessage(nLength+1) As Global Byte
        lpszMessage = VarPtr(textMessage(0))
        Control Send hDlg, %IDC_MESSAGE, %WM_GETTEXT, nLength+1, lpszMessage
    Has anyone seen a similar issue using %Unicode=1 with SocketTools?



  • #2
    FYI ... Mike generously responded to me offline on Saturday. We found a work-around not involving the code above. Just a matter of forcing one of the API elsewhere in the code to use A instead of W.

    I went ahead and purchased the SocketTools Library Edition. Of course, right in the middle of integration, my service provider had trouble with their mail server, shutting down my testing for a couple of hours.

    So far, I've integrated send mail into the email client I've been working on. Receiving email is next on the list.

    Comment


    • #3
      Just in case anyone else is wondering, there was a couple of issues at hand. One is there was an actual bug in the Unicode version of the SmtpSubmitMessage function that was incorrectly reporting an "out of memory" error when there wasn't actually one. I'll be making a fix available to folks who need it.

      Also, remember that just declaring %UNICODE at the beginning of your code isn't the whole solution. This will cause the Unicode version of functions and structure declarations to use their Unicode counterparts, but you also need to change string variables from STRINGZ to WSTRINGZ. Be particularly careful when passing pointers around because the compiler won't necessarily help you catch these kinds of errors. For example, you can use VARPTR to get the address of an ANSI string, and assign that to a structure member that expects a Unicode null-terminated string, and the compiler isn't going to warn you about it.
      Mike Stefanik
      sockettools.com

      Comment

      Working...
      X