FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OLE GPF
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: Tue Sep 02, 2008 08: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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
OLE GPF
Posted: Tue Sep 02, 2008 09: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: Wed Sep 03, 2008 01: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: Wed Sep 03, 2008 01:14 PM
Darrell,

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

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
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: Wed Sep 03, 2008 02: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: Wed Sep 03, 2008 07:27 PM

You have to open OutLook before running that code.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: Wed Sep 03, 2008 07:33 PM

Antonio,

Outlook 2007 was open

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: Wed Sep 03, 2008 08:49 PM
Darrell,

This test is working fine here:

test.prg
#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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: Wed Sep 03, 2008 08: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
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: 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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: Wed Sep 03, 2008 11:07 PM
Darrell,

This code works fine here:
#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
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
OLE GPF
Posted: Thu Sep 04, 2008 12:17 AM

Yes, Outlook 2007 SP1

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: 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
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
OLE GPF
Posted: Thu Sep 04, 2008 02: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
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
OLE GPF
Posted: 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