Page 1 of 1
GetActiveObject + FWH = Windows Exception
Posted: Wed May 10, 2006 5:25 pm
by Gale FORd
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
Re: GetActiveObject + FWH = Windows Exception
Posted: Wed May 10, 2006 6:51 pm
by Richard Chidiak
Gale 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
Gale
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
Posted: Wed May 10, 2006 7:13 pm
by Gale FORd
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?
Re: GetActiveObject + FWH = Windows Exception
Posted: Wed May 10, 2006 7:25 pm
by Richard Chidiak
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?
The result should be the same with or without #include "fivewin.ch" as you are calling xharbour's OLE native library in both cases.
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
Posted: Wed May 10, 2006 7:40 pm
by Gale FORd
No problem.
But just FYI it does not error when it is native xHarbour. With fivewin linked in it errors.
Thanks,
Posted: Wed May 10, 2006 9:10 pm
by Randal
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
Posted: Wed May 10, 2006 9:54 pm
by Gale FORd
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, it is works when Ole2TxtError() is removed.
Yes, I am using xHarbour Builder (xcc)
Posted: Thu May 11, 2006 8:05 am
by Antonio Linares
FWH provides a Ole2TxtError() and it seems that xHB does it too.
We may rename FWH functions to avoid these conflicts.
Posted: Thu May 11, 2006 2:49 pm
by Randal
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
Posted: Thu May 11, 2006 3:03 pm
by Gale FORd
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
I don't know about replacing the activex lib but when I compile and run webexp.prg I get the following error.
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)
Posted: Thu May 11, 2006 6:22 pm
by Antonio Linares
Gale,
Please use this ActiveX.lib:
http://fivetechsoft.com/forums/viewtopic.php?t=3003
instead of the one provided with xHB.
Posted: Thu May 11, 2006 6:40 pm
by Gale FORd
I renamed c:\xhb\lib\activex.lib
I downloaded activex.lib
Now I get a unresolved external symbal _hb_fun_tactivex
Posted: Thu May 11, 2006 6:41 pm
by Antonio Linares
Gale,
TActiveX is provided in FiveHMX.lib. Have you rebuilt it ?
Posted: Thu May 11, 2006 6:45 pm
by Antonio Linares
Gale,
Please use FiveHMX.lib, the one we provide, without rebuild it.
Posted: Thu May 11, 2006 6:55 pm
by Gale FORd
Antonio Linares wrote:Gale,
Please use FiveHMX.lib, the one we provide, without rebuild it.
I added fwh\source\classes\activex.prg to fivehmx.lib.xbp
After rebuilding FiveHMX.lib the sample works fine.