WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

OLE and BYREF return parameters

Keywords:   BYREF return parameters

Question:

I have written a COM component in VB to send emails. One parameter, an error description, should be returning a value when an error is encountered. In my VB program, that parameter is defined as "ByRef". I believe that my program is working correctly, but the value that I'm passing back in ErrDescr is not showing up in my Winbatch variable. Any ideas?
MailObj = ObjectOpen("dllSendMail.dllSendMail")
Sender = "crccdi@exchange.nordstrom.com"
Recipient = "xjlr@exchange.nordstrom.com"
Subject = "any old subject"
Body = "any old body text"
ErrDescr = " "
Attachment1 = "d:\found.not"
RC = MailObj.SendMail_Send(Sender,Recipient,Subject,Body,ErrDescr,Attachment1) 

Answer:

The basic problem is that Winbatch is not 100% happy with BYREF return parameters. Thus the route via a Binary Buffer is required.



MailObj = ObjectOpen("dllSendMail.dllSendMail")
Sender = "crccdi@exchange.nordstrom.com"
Recipient = "xjlr@exchange.nordstrom.com"
Subject = "any old subject"
Body = "any old body text"
bb=BinaryAlloc(2000)
BinaryOleType(bb, 200+2,0,0,0)
Attachment1 = "d:\found.not"
RC = MailObj.SendMail_Send(Sender,Recipient,Subject,Body,bb,Attachment1) 
ErrDescr=BinaryPeekStr(bb,0,BinaryEodGet(bb))
BinaryFree(bb)




Article ID:   W15580
File Created: 2003:05:28:10:21:42
Last Updated: 2003:05:28:10:21:42