Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #7042 > unrolled thread

OLEAutoObject with Outlook 32-bit under Win7 64-bit

Started byGlenn Keeler <glennkeeler@shaw.ca>
First post2014-07-10 07:58 -0700
Last post2014-07-11 14:20 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  OLEAutoObject with Outlook 32-bit under Win7 64-bit Glenn Keeler <glennkeeler@shaw.ca> - 2014-07-10 07:58 -0700
    Re: OLEAutoObject with Outlook 32-bit under Win7 64-bit "Gerhard Bunzel" <g.bunzel@domonet.de> - 2014-07-11 11:07 +0200
      Re: OLEAutoObject with Outlook 32-bit under Win7 64-bit Glenn Keeler <glennkeeler@shaw.ca> - 2014-07-11 10:24 -0700
    Re: OLEAutoObject with Outlook 32-bit under Win7 64-bit "Jamal" <someone@example.com> - 2014-07-11 07:00 -0400
      Re: OLEAutoObject with Outlook 32-bit under Win7 64-bit Glenn Keeler <glennkeeler@shaw.ca> - 2014-07-11 14:20 -0700

#7042 — OLEAutoObject with Outlook 32-bit under Win7 64-bit

FromGlenn Keeler <glennkeeler@shaw.ca>
Date2014-07-10 07:58 -0700
SubjectOLEAutoObject with Outlook 32-bit under Win7 64-bit
Message-ID<9b4ab259-1b9c-4a32-a1ef-3b371bdf861f@googlegroups.com>
I have been running stuck on getting a particular OLEAutoObject process to function in the mixed environment where my app and Outlook are 32 bit, but the OS is 64-bit.

This works perfectly under Win7 32-bit, but when under Win7 64-bit produces no visible results not even the various error messages you see in the code. It is as if this function is hanging at the OLEAutoObject call.

My only hunch is that perhaps this has to do with Registry access of 32-bit programs, but that hunch does not get me very far in fixing this. I am pasting the very standard code below. Any suggestions are welcome although note that a) direct SMTP is not an option as security policies prevent that at my client sites and b) MAPI calls in this environment result in windows error messages and are modal which is not desirable.

Thanks.

//--------------------------------
FUNCTION SendMailOutlook(aEmail AS ARRAY, aCC AS ARRAY, aBCC AS ARRAY, aFiles AS ARRAY, cSubject AS STRING, cText AS STRING) AS LOGIC
LOCAL oOutlook          AS USUAL
LOCAL oMail             AS USUAL
LOCAL oAttachment       AS USUAL
LOCAL nCount            AS DWORD
LOCAL lContinue         AS LOGIC
LOCAL oRecipient         AS USUAL
                                                                                                                            
lContinue       := TRUE

// Init outlook object
oOutlook := OLEAutoObject{"Outlook.Application"}
IF !oOutlook:fInit
   lContinue := FALSE                            
   ErrorBox{,"Failed to initiate Outlook remote server"}:show()
END

IF lContinue
   oMail:=oOutlook:CreateItem(0)
   IF oMail = NULL_OBJECT                                      
      ErrorBox{,"Failed to create mail object"}:show()
      lContinue := FALSE
   END
END

// OK
IF lContinue
   // To
   FOR nCount:=1 UPTO ALen(aEmail)
      oRecipient := oMail:Recipients:Add(AllTrim(aEmail[nCount]))
      oRecipient:Type := 1   // TO=1
   NEXT
   
   // CC
   FOR nCount := 1 UPTO ALen(aCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aCC[nCount]))
      oRecipient:Type := 2   // CC=2
   NEXT
   
   // BCC
   FOR nCount := 1 UPTO ALen(aBCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aBCC[nCount]))
      oRecipient:Type := 3   // BCC=3
   NEXT

   // Check addresses
   IF oMail:Recipients:ResolveAll()
      // Set subject
      oMail:Subject := cSubject
      IF "<HTML" $ Upper(cText)
         oMail:HTMLBody := cText
      ELSE
         oMail:Body := cText
      END
	  
      // Attach a file
      oAttachment := oMail:Attachments
      FOR nCount := 1 UPTO ALen(aFiles)
         oAttachment:Add(aFiles[nCount])
      NEXT
      oMail:Display()
   ELSE
      lContinue := FALSE
      ErrorBox{,"Error resolving email addresses"}:show()
   ENDIF 
ELSE
   ErrorBox{,"Error sending Outlook mail"}:show()
ENDIF 

RETURN lContinue

[toc] | [next] | [standalone]


#7043

From"Gerhard Bunzel" <g.bunzel@domonet.de>
Date2014-07-11 11:07 +0200
Message-ID<lpo9f9$8t9$1@news.m-online.net>
In reply to#7042
Glenn,

maybe this helps:
http://www.codeproject.com/Tips/267554/Using-bit-COM-Object-from-bit-Application


HTH

Gerhard Bunzel



"Glenn Keeler" <glennkeeler@shaw.ca> schrieb im Newsbeitrag 
news:9b4ab259-1b9c-4a32-a1ef-3b371bdf861f@googlegroups.com...
I have been running stuck on getting a particular OLEAutoObject process to 
function in the mixed environment where my app and Outlook are 32 bit, but 
the OS is 64-bit.

This works perfectly under Win7 32-bit, but when under Win7 64-bit produces 
no visible results not even the various error messages you see in the code. 
It is as if this function is hanging at the OLEAutoObject call.

My only hunch is that perhaps this has to do with Registry access of 32-bit 
programs, but that hunch does not get me very far in fixing this. I am 
pasting the very standard code below. Any suggestions are welcome although 
note that a) direct SMTP is not an option as security policies prevent that 
at my client sites and b) MAPI calls in this environment result in windows 
error messages and are modal which is not desirable.

Thanks.

//--------------------------------
FUNCTION SendMailOutlook(aEmail AS ARRAY, aCC AS ARRAY, aBCC AS ARRAY, 
aFiles AS ARRAY, cSubject AS STRING, cText AS STRING) AS LOGIC
LOCAL oOutlook          AS USUAL
LOCAL oMail             AS USUAL
LOCAL oAttachment       AS USUAL
LOCAL nCount            AS DWORD
LOCAL lContinue         AS LOGIC
LOCAL oRecipient         AS USUAL

lContinue       := TRUE

// Init outlook object
oOutlook := OLEAutoObject{"Outlook.Application"}
IF !oOutlook:fInit
   lContinue := FALSE
   ErrorBox{,"Failed to initiate Outlook remote server"}:show()
END

IF lContinue
   oMail:=oOutlook:CreateItem(0)
   IF oMail = NULL_OBJECT
      ErrorBox{,"Failed to create mail object"}:show()
      lContinue := FALSE
   END
END

// OK
IF lContinue
   // To
   FOR nCount:=1 UPTO ALen(aEmail)
      oRecipient := oMail:Recipients:Add(AllTrim(aEmail[nCount]))
      oRecipient:Type := 1   // TO=1
   NEXT

   // CC
   FOR nCount := 1 UPTO ALen(aCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aCC[nCount]))
      oRecipient:Type := 2   // CC=2
   NEXT

   // BCC
   FOR nCount := 1 UPTO ALen(aBCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aBCC[nCount]))
      oRecipient:Type := 3   // BCC=3
   NEXT

   // Check addresses
   IF oMail:Recipients:ResolveAll()
      // Set subject
      oMail:Subject := cSubject
      IF "<HTML" $ Upper(cText)
         oMail:HTMLBody := cText
      ELSE
         oMail:Body := cText
      END

      // Attach a file
      oAttachment := oMail:Attachments
      FOR nCount := 1 UPTO ALen(aFiles)
         oAttachment:Add(aFiles[nCount])
      NEXT
      oMail:Display()
   ELSE
      lContinue := FALSE
      ErrorBox{,"Error resolving email addresses"}:show()
   ENDIF
ELSE
   ErrorBox{,"Error sending Outlook mail"}:show()
ENDIF

RETURN lContinue

[toc] | [prev] | [next] | [standalone]


#7047

FromGlenn Keeler <glennkeeler@shaw.ca>
Date2014-07-11 10:24 -0700
Message-ID<834fc917-a7fb-47dd-948f-a42e6a179ac3@googlegroups.com>
In reply to#7043
On Friday, July 11, 2014 3:07:12 AM UTC-6, Gerhard Bunzel wrote:
> 
> maybe this helps:
> 
> http://www.codeproject.com/Tips/267554/Using-bit-COM-Object-from-bit-Application
> 

Thanks Gerhard. This doesn't, at least at first blush, directly apply but it does suggest that my guess at Registry access issues is likely the issue. It is also interesting as I have been told categorically that 64-bit programs using 32-bit ole is not possible.

[toc] | [prev] | [next] | [standalone]


#7044

From"Jamal" <someone@example.com>
Date2014-07-11 07:00 -0400
Message-ID<lpog54$8jo$1@speranza.aioe.org>
In reply to#7042
Glenn,

I have sites using my app with a mixed environment like yours with no 
problem.

BTW, change

LOCAL oOutlook          AS USUAL

to

LOCAL oOutlook   AS OBJECT

Note sure if above will make a difference.

Your options:
1. You may want to create another Windows user as an administrator and try 
your code again.
2. Try to disable an anti-virus software temporarily which might be blocking 
scripting of OLE objects to see if that could be a reason.

Jamal


"Glenn Keeler"  wrote in message 
news:9b4ab259-1b9c-4a32-a1ef-3b371bdf861f@googlegroups.com...

I have been running stuck on getting a particular OLEAutoObject process to 
function in the mixed environment where my app and Outlook are 32 bit, but 
the OS is 64-bit.

This works perfectly under Win7 32-bit, but when under Win7 64-bit produces 
no visible results not even the various error messages you see in the code. 
It is as if this function is hanging at the OLEAutoObject call.

My only hunch is that perhaps this has to do with Registry access of 32-bit 
programs, but that hunch does not get me very far in fixing this. I am 
pasting the very standard code below. Any suggestions are welcome although 
note that a) direct SMTP is not an option as security policies prevent that 
at my client sites and b) MAPI calls in this environment result in windows 
error messages and are modal which is not desirable.

Thanks.

//--------------------------------
FUNCTION SendMailOutlook(aEmail AS ARRAY, aCC AS ARRAY, aBCC AS ARRAY, 
aFiles AS ARRAY, cSubject AS STRING, cText AS STRING) AS LOGIC
LOCAL oOutlook          AS USUAL
LOCAL oMail             AS USUAL
LOCAL oAttachment       AS USUAL
LOCAL nCount            AS DWORD
LOCAL lContinue         AS LOGIC
LOCAL oRecipient         AS USUAL

lContinue       := TRUE

// Init outlook object
oOutlook := OLEAutoObject{"Outlook.Application"}
IF !oOutlook:fInit
   lContinue := FALSE
   ErrorBox{,"Failed to initiate Outlook remote server"}:show()
END

IF lContinue
   oMail:=oOutlook:CreateItem(0)
   IF oMail = NULL_OBJECT
      ErrorBox{,"Failed to create mail object"}:show()
      lContinue := FALSE
   END
END

// OK
IF lContinue
   // To
   FOR nCount:=1 UPTO ALen(aEmail)
      oRecipient := oMail:Recipients:Add(AllTrim(aEmail[nCount]))
      oRecipient:Type := 1   // TO=1
   NEXT

   // CC
   FOR nCount := 1 UPTO ALen(aCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aCC[nCount]))
      oRecipient:Type := 2   // CC=2
   NEXT

   // BCC
   FOR nCount := 1 UPTO ALen(aBCC)
      oRecipient := oMail:Recipients:Add(AllTrim(aBCC[nCount]))
      oRecipient:Type := 3   // BCC=3
   NEXT

   // Check addresses
   IF oMail:Recipients:ResolveAll()
      // Set subject
      oMail:Subject := cSubject
      IF "<HTML" $ Upper(cText)
         oMail:HTMLBody := cText
      ELSE
         oMail:Body := cText
      END

      // Attach a file
      oAttachment := oMail:Attachments
      FOR nCount := 1 UPTO ALen(aFiles)
         oAttachment:Add(aFiles[nCount])
      NEXT
      oMail:Display()
   ELSE
      lContinue := FALSE
      ErrorBox{,"Error resolving email addresses"}:show()
   ENDIF
ELSE
   ErrorBox{,"Error sending Outlook mail"}:show()
ENDIF

RETURN lContinue 

[toc] | [prev] | [next] | [standalone]


#7049

FromGlenn Keeler <glennkeeler@shaw.ca>
Date2014-07-11 14:20 -0700
Message-ID<b3862975-65d4-4614-8f12-b12602e291a7@googlegroups.com>
In reply to#7044
On Friday, July 11, 2014 5:00:55 AM UTC-6, Jamal wrote:

> 
> I have sites using my app with a mixed environment like yours with no 
> problem.

Jamal,

Thanks for the confirmation that this does work elsewhere! I therefore suspect that it means that it is something about our network or how our machines were created (from an image and with a migration tool) that is causing this issue.

> 
> BTW, change
> LOCAL oOutlook          AS USUAL
> to
> LOCAL oOutlook   AS OBJECT

The change did not have any effect but it is the right thing to do.

> 1. You may want to create another Windows user as an administrator and try 
> your code again.

I am working on setting up a new machine to play with these kinds of issues.
 
> 2. Try to disable an anti-virus software temporarily which might be blocking 
> scripting of OLE objects to see if that could be a reason.

I have tried disabling the on-access scanning, but will look for more specific OLE blocking settings. 

Thanks for the pointers.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web