OLE GPF

OLE GPF

Postby cdmmaui » Tue Sep 02, 2008 8:40 pm

Hello, I am getting a GPF with the following OLE code. Can anyone help?

TRY
hOutlook := CreateOLEObject( "Outlook.Application" )
hAppItem := OLEInvoke( hOutlook, "CreateItem", 1 )
OLESetProperty( hAppItem, "Start", DTOC(dDate) + " " + cTime )
OLESetProperty( hAppItem, "StartTime", cTime + ":00" )
SET CENTURY ON
OLESetProperty( hAppItem, "Duration", nLenInMin * 60 )
OLESetProperty( hAppItem, "Subject", cSubject )
OLESetProperty( hAppItem, "Body", cNotiz )
OLESetProperty( hAppItem, "Mileage", 225 )
OLEInvoke( hAppItem, "Save" )
hAppItem := NIL
hOutlook := NIL
lSave := .t.
CATCH oErr
lSave := .f.
cErrMsg += ' ' + cEol
cErrMsg += 'oErr:Subsystem = ' + oErr:subsystem + cEol
cErrMsg += 'oErr:Subcode = ' + Ltrim( Str( oErr:subCode ) ) + cEol
cErrMsg += 'oErr:description = ' + oErr:description + cEol
cErrMsg += 'oErr:filename = ' + oErr:filename + cEol
cErrMsg += 'oErr:Operation = ' + oErr:Operation + cEol
END
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby driessen » Tue Sep 02, 2008 9:08 pm

Which version of Outlook are you using ?

I had a similar problem with Outlook 2007 but not with previous versions.

The GPF disappeared after I added a test which checks if Outlook2007 has already been opened and if not, Outlook 2007 is opened by using WinExec() before the CreateObject().

Might this also be your problem ?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby cdmmaui » Wed Sep 03, 2008 1:07 pm

Hi Michel, thank you. Can you provide a sample so I can include in my code?
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Wed Sep 03, 2008 1:14 pm

Darrell,

With the recents and current FWH versions, you can do it this way:

Code: Select all  Expand view  RUN
TRY
   oOutlook := CreateObject( "Outlook.Application" )
   oAppItem := oOutlook:CreateItem( 1 )
   oAppItem:Start = DTOC(dDate) + " " + cTime
   oAppItem:StartTime = cTime + ":00"
   SET CENTURY ON
   oAppItem:Duration = nLenInMin * 60
   oAppItem:Subject = cSubject
   oAppItem:Body = cNotiz
   oAppItem:Mileage = 225
   oAppItem:Save()
   lSave := .t.
CATCH oErr
   lSave := .f.
   cErrMsg += ' ' + cEol
   cErrMsg += 'oErr:Subsystem = ' + oErr:subsystem + cEol
   cErrMsg += 'oErr:Subcode = ' + Ltrim( Str( oErr:subCode ) ) + cEol
   cErrMsg += 'oErr:description = ' + oErr:description + cEol
   cErrMsg += 'oErr:filename = ' + oErr:filename + cEol
   cErrMsg += 'oErr:Operation = ' + oErr:Operation + cEol
END
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Wed Sep 03, 2008 2:31 pm

Hi Antonio,

I am not getting GPF but I am getting the following error.

oErr:Subsystem = Outlook.Application:CREATEITEM
oErr:Subcode = 0
oErr:description = S_OK
oErr:filename =
oErr:Operation = _START

Any ideas?
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Wed Sep 03, 2008 7:27 pm

You have to open OutLook before running that code.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Wed Sep 03, 2008 7:33 pm

Antonio,

Outlook 2007 was open
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Wed Sep 03, 2008 8:49 pm

Darrell,

This test is working fine here:

test.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oOutlook := CreateObject( "Outlook.Application" )
   local oAppItem := oOutlook:CreateItem( 1 )

   MsgInfo( "done" )

return nil

Here you have the EXE:
http://rapidshare.com/files/142402543/Darrell.zip.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Sep 03, 2008 8:52 pm

Darrell,

Ok, I see whats going on:

Please don't use TRY ... CATCH as the Class TOleAuto use ON ERROR to route the messages, so they get catched as errors but they are not errors :-)

Thats why in the error description you get S_OK, reporting that everything was ok :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Wed Sep 03, 2008 10:11 pm

Hi Antonio,

I removed TRY...CATCH...END and got the following error.

Application
===========
Path and name: C:\Winapps\cargo\quote.exe (32 bits)
Size: 2,001,920 bytes
Time from start: 0 hours 0 mins 12 secs
Error occurred at: 09/03/2008, 17:05:07
Error description: Error Outlook.Application:CREATEITEM/0 S_OK: _START
Args:
[ 1] = C 06/27/2008 17

Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:_START(0)
Called from: setup.prg => ADD_OL_APPT(5177)
Called from: quote.prg => EDITQTE(644)
Called from: quote.prg => (b)MAIN(85)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: quote.prg => MAIN(150)
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Wed Sep 03, 2008 11:07 pm

Darrell,

This code works fine here:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oOutlook := CreateObject( "Outlook.Application" )
   local oAppItem := oOutlook:CreateItem( 1 )
   
   oAppItem:Start = DTOC( Date() ) + " " + Time()

   MsgInfo( "done" )

return nil

Are you using Office 2007 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby cdmmaui » Thu Sep 04, 2008 12:17 am

Yes, Outlook 2007 SP1
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Thu Sep 04, 2008 12:36 am

Darrell,

Do you also get an error with the above code ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby richard-service » Thu Sep 04, 2008 2:05 am

Antonio Linares wrote:Darrell,

Do you also get an error with the above code ?


Hi Antonio,

I also get error same as Darrell.

Error description: Error Outlook.Application:CREATEITEM/16389 E_FAIL: _START

I use OutLook 2007 SP1, when opened and not opened OutLook.

Regards,

Richard
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Postby Antonio Linares » Thu Sep 04, 2008 12:51 pm

Richard,

Are you using XP or Vista ?

Here, with Vista, it is ok.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests