OLE GPF
- cdmmaui
- Posts: 653
- Joined: Fri Oct 28, 2005 9:53 am
- Location: The Woodlands - Dallas - Scottsdale - London
- Contact:
OLE GPF
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
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
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 ?
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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Darrell,
With the recents and current FWH versions, you can do it this way:
With the recents and current FWH versions, you can do it this way:
Code: Select all
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Darrell,
This test is working fine here:
test.prg
Here you have the EXE:
http://rapidshare.com/files/142402543/Darrell.zip.html
This test is working fine here:
test.prg
Code: Select all
#include "FiveWin.ch"
function Main()
local oOutlook := CreateObject( "Outlook.Application" )
local oAppItem := oOutlook:CreateItem( 1 )
MsgInfo( "done" )
return nil
http://rapidshare.com/files/142402543/Darrell.zip.html
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- cdmmaui
- Posts: 653
- Joined: Fri Oct 28, 2005 9:53 am
- Location: The Woodlands - Dallas - Scottsdale - London
- Contact:
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)
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)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Darrell,
This code works fine here:
Are you using Office 2007 ?
This code works fine here:
Code: Select all
#include "FiveWin.ch"
function Main()
local oOutlook := CreateObject( "Outlook.Application" )
local oAppItem := oOutlook:CreateItem( 1 )
oAppItem:Start = DTOC( Date() ) + " " + Time()
MsgInfo( "done" )
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- richard-service
- Posts: 583
- Joined: Tue Oct 16, 2007 8:57 am
- Location: New Taipei City, Taiwan
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: