GetActiveObject + FWH = Windows Exception

GetActiveObject + FWH = Windows Exception

Postby Gale FORd » Wed May 10, 2006 5: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: GetActiveObject + FWH = Windows Exception

Postby Richard Chidiak » Wed May 10, 2006 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: GetActiveObject + FWH = Windows Exception

Postby Gale FORd » Wed May 10, 2006 7: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?
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: GetActiveObject + FWH = Windows Exception

Postby Richard Chidiak » Wed May 10, 2006 7: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: GetActiveObject + FWH = Windows Exception

Postby Gale FORd » Wed May 10, 2006 7:40 pm

No problem.

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

Thanks,
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Randal » Wed May 10, 2006 9: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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Gale FORd » Wed May 10, 2006 9: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)
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Antonio Linares » Thu May 11, 2006 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Randal » Thu May 11, 2006 2: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
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Gale FORd » Thu May 11, 2006 3: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)
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Antonio Linares » Thu May 11, 2006 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Gale FORd » Thu May 11, 2006 6: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Antonio Linares » Thu May 11, 2006 6:41 pm

Gale,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Thu May 11, 2006 6:45 pm

Gale,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Gale FORd » Thu May 11, 2006 6: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests