GetActiveObject + FWH = Windows Exception
GetActiveObject + FWH = Windows Exception
I just upgraded to FWH 2.7 and March 2006 xHarbour Builder.
Most everything works ok except for a couple of things.
I have narrowed it down to the sample below that creates the windows exception error.
If you remove the section with GetActiveObject() function there is no exception error.
#INCLUDE "FIVEWIN.CH"
function main
local oExcel
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
Alert( "ERROR! Excel not avialable. [" + Ole2TxtError()+ "]" )
RETU(.f.)
END
END
oExcel:WorkBooks:Add()
oExcel:Visible := .t.
return nil
Most everything works ok except for a couple of things.
I have narrowed it down to the sample below that creates the windows exception error.
If you remove the section with GetActiveObject() function there is no exception error.
#INCLUDE "FIVEWIN.CH"
function main
local oExcel
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
Alert( "ERROR! Excel not avialable. [" + Ole2TxtError()+ "]" )
RETU(.f.)
END
END
oExcel:WorkBooks:Add()
oExcel:Visible := .t.
return nil
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
Re: GetActiveObject + FWH = Windows Exception
GaleGale FORd wrote:I just upgraded to FWH 2.7 and March 2006 xHarbour Builder.
Most everything works ok except for a couple of things.
I have narrowed it down to the sample below that creates the windows exception error.
If you remove the section with GetActiveObject() function there is no exception error.
#INCLUDE "FIVEWIN.CH"
function main
local oExcel
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
Alert( "ERROR! Excel not avialable. [" + Ole2TxtError()+ "]" )
RETU(.f.)
END
END
oExcel:WorkBooks:Add()
oExcel:Visible := .t.
return nil
try it this way
TRY
oExcel := CREATEOBJECT( "Excel.Application" )
CATCH
TRY
oExcel := CREATEOBJECT( "Excel.Application" )
CATCH
MSGSTOP("L'Application Microsoft Excel n'est pas installée sur cet Ordinateur !" )
RETURN NIL
END
END
Richard
Re: GetActiveObject + FWH = Windows Exception
CreateObject() works ok.
GetActiveObject() does not work ok with FWH?
If I compile without #include "fivewin.ch" it works ok.
Is there a reason not to use it?
GetActiveObject() does not work ok with FWH?
If I compile without #include "fivewin.ch" it works ok.
Is there a reason not to use it?
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
Re: GetActiveObject + FWH = Windows Exception
The result should be the same with or without #include "fivewin.ch" as you are calling xharbour's OLE native library in both cases.Gale FORd wrote:CreateObject() works ok.
GetActiveObject() does not work ok with FWH?
If I compile without #include "fivewin.ch" it works ok.
Is there a reason not to use it?
From my experience Getactiveobject() will work OK if the object is always active (like Internet explorer) , but will also fail and gpfs in certain cases.
I have decided not to use it and replace with Createobject() that always works either for excel, word or Internet explorer.
Richard
Re: GetActiveObject + FWH = Windows Exception
No problem.
But just FYI it does not error when it is native xHarbour. With fivewin linked in it errors.
Thanks,
But just FYI it does not error when it is native xHarbour. With fivewin linked in it errors.
Thanks,
Gale,
I have the same problem. I think there is some problem or conflict between xBuilder and FWH activex/ole features. Are you using xcc?
If you include fivewin.ch try removing the call to Ole2TxtError() in the Alert function and see if that works. Be interested to know your results.
Thanks,
Randal Ferguson
I have the same problem. I think there is some problem or conflict between xBuilder and FWH activex/ole features. Are you using xcc?
If you include fivewin.ch try removing the call to Ole2TxtError() in the Alert function and see if that works. Be interested to know your results.
Thanks,
Randal Ferguson
Yes, it is works when Ole2TxtError() is removed.Randal Ferguson wrote:Gale,
I have the same problem. I think there is some problem or conflict between xBuilder and FWH activex/ole features. Are you using xcc?
If you include fivewin.ch try removing the call to Ole2TxtError() in the Alert function and see if that works. Be interested to know your results.
Thanks,
Randal Ferguson
Yes, I am using xHarbour Builder (xcc)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Gale,
Can you get the webexp.prg sample in \fwh\samples to work using xBuilder?
Antonio posted a link here recently for a new activex.lib we should link instead of the one that comes with xHarbour. I cannot get it to work which makes me think there is some incompatibilities using FWH ActiveX with xBuilder. If I build the webexp sample using harbour or xharbour with bcc it works fine.
Using xBuilder/xcc with the activex lib Antonio posted I get:
Application
===========
Path and name: D:\xHB\bin\webexp.exe (32 bits)
Size: 1,504,768 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/11/06, 09:42:34
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Args:
Stack Calls
===========
Called from: => HWND(0)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: TActiveX.prg => CREATEACTIVEX(184)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: webexp.prg => MAIN(11)
Thanks,
Randal Ferguson
Can you get the webexp.prg sample in \fwh\samples to work using xBuilder?
Antonio posted a link here recently for a new activex.lib we should link instead of the one that comes with xHarbour. I cannot get it to work which makes me think there is some incompatibilities using FWH ActiveX with xBuilder. If I build the webexp sample using harbour or xharbour with bcc it works fine.
Using xBuilder/xcc with the activex lib Antonio posted I get:
Application
===========
Path and name: D:\xHB\bin\webexp.exe (32 bits)
Size: 1,504,768 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/11/06, 09:42:34
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Args:
Stack Calls
===========
Called from: => HWND(0)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: TActiveX.prg => CREATEACTIVEX(184)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: webexp.prg => MAIN(11)
Thanks,
Randal Ferguson
I don't know about replacing the activex lib but when I compile and run webexp.prg I get the following error.Randal Ferguson wrote:Gale,
Can you get the webexp.prg sample in \fwh\samples to work using xBuilder?
Antonio posted a link here recently for a new activex.lib we should link instead of the one that comes with xHarbour. I cannot get it to work which makes me think there is some incompatibilities using FWH ActiveX with xBuilder. If I build the webexp sample using harbour or xharbour with bcc it works fine.
Using xBuilder/xcc with the activex lib Antonio posted I get:
Application
===========
Path and name: D:\xHB\bin\webexp.exe (32 bits)
Size: 1,504,768 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/11/06, 09:42:34
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Args:
Stack Calls
===========
Called from: => HWND(0)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: TActiveX.prg => CREATEACTIVEX(184)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: webexp.prg => MAIN(11)
Thanks,
Randal Ferguson
Application
===========
Path and name: c:\FWH\SAMPLES\webexp.exe (32 bits)
Size: 1,531,904 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/11/06, 09:56:21
Error description: Error Shell.Explorer/16389 E_FAIL: _BONEVENT
Args:
[ 1] = B {|| ... }
Stack Calls
===========
Called from: TActiveX.prg => TACTIVEX:_BONEVENT(0)
Called from: webexp.prg => MAIN(20)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Gale,
Please use this ActiveX.lib:
http://fivetechsoft.com/forums/viewtopic.php?t=3003
instead of the one provided with xHB.
Please use this ActiveX.lib:
http://fivetechsoft.com/forums/viewtopic.php?t=3003
instead of the one provided with xHB.
I renamed c:\xhb\lib\activex.libAntonio Linares wrote:Gale,
Please use this ActiveX.lib:
http://fivetechsoft.com/forums/viewtopic.php?t=3003
instead of the one provided with xHB.
I downloaded activex.lib
Now I get a unresolved external symbal _hb_fun_tactivex
- 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: