FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetActiveObject + FWH = Windows Exception
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 05:25 PM

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

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM

Re: GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 06:51 PM
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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

Re: GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 07:13 PM

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?

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM

Re: GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 07:25 PM
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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

Re: GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 07:40 PM

No problem.

But just FYI it does not error when it is native xHarbour. With fivewin linked in it errors.

Thanks,

Posts: 284
Joined: Mon Oct 24, 2005 08:04 PM

GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 09:10 PM

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

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

GetActiveObject + FWH = Windows Exception

Posted: Wed May 10, 2006 09:54 PM
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)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 08:05 AM

FWH provides a Ole2TxtError() and it seems that xHB does it too.

We may rename FWH functions to avoid these conflicts.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 284
Joined: Mon Oct 24, 2005 08:04 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 02:49 PM

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

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 03:03 PM
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)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 06:22 PM

Gale,

Please use this ActiveX.lib:

http://fivetechsoft.com/forums/viewtopic.php?t=3003
instead of the one provided with xHB.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 06:40 PM
Antonio Linares wrote:Gale,

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.lib
I downloaded activex.lib

Now I get a unresolved external symbal _hb_fun_tactivex
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 06:41 PM

Gale,

TActiveX is provided in FiveHMX.lib. Have you rebuilt it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 06:45 PM

Gale,

Please use FiveHMX.lib, the one we provide, without rebuild it.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM

GetActiveObject + FWH = Windows Exception

Posted: Thu May 11, 2006 06:55 PM
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.

Continue the discussion