Migrating to Harbour

User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

OleDefaultArg()

is a shortcut to:

VTWrapper( VT_ERROR, DISP_E_PARAMNOTFOUND )
Thank you. This is what I just tried (extract from xHarbour's win32ole.prg), but unfortunately it doesn't work:

Code: Select all

FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL cXls := "e:\xharbour\test.xls"

    oExcel:WorkBooks:Open( cXls, , , OLEDEFAULTARG(), , , , OLEDEFAULTARG(), , , .T., , .T. )

    oExcel:Visible = .T.

    RETURN NIL


#define VT_ERROR 10
#define DISP_E_PARAMNOTFOUND 0x80020004


FUNCTION OLEDEFAULTARG()

    RETURN VTWRAPPER( VT_ERROR, DISP_E_PARAMNOTFOUND )


#include "Hbclass.ch"


CLASS VTWrapper

    DATA vt
    DATA Value

    METHOD New( vt, xVal ) CONSTRUCTOR

    ENDCLASS


METHOD New( vt, xVal ) CLASS VTWrapper

    ::vt := vt
    ::Value := xVal

    RETURN Self
I get:
Error WINOLE/1007 Impossibile trovare la proprieta Open per la classe Workbooks. (0x800A03EC): Microsoft Excel (DOS Error -2147352567)
Called from TOLEAUTO:OPEN(0)
Called from MAIN(7)
EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

Please take a look at the excel workbooks property

http://msdn.microsoft.com/en-us/library ... e.12).aspx

Oledefaultarg() is supposed to be the format parameter ?

Format Optional Variant If Microsoft Excel is opening a text file, this argument specifies the delimiter character. If this argument is omitted, the current delimiter is used. For more information on the values used by this parameter, see the Remarks section.

oExcel:WorkBooks:Open( cXls) will work ok

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

Please take a look at the excel workbooks property

http://msdn.microsoft.com/en-us/library ... e.12).aspx

Oledefaultarg() is supposed to be the format parameter ?

Format Optional Variant If Microsoft Excel is opening a text file, this argument specifies the delimiter character. If this argument is omitted, the current delimiter is used. For more information on the values used by this parameter, see the Remarks section.

oExcel:WorkBooks:Open( cXls) will work ok

Hth

Richard
My sample doesn't work without OleDefaultArg(). If I'm wrong, please show me how to successfully run it.

EMG
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Migrating to Harbour

Post by Richard Chidiak »

Enrico

The code below works OK with Harbour if the file exists

I tried it with a file on my disk at it opened ok.

Note : I executed my test program as an administrator

Compiled with Harbour and Msvc

I sent you by email the exe , this way you can check your Harbour configuration also.

Richard

Code: Select all

#INCLUDE "FIVEWIN.CH"

function Main()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL cXls  := CGETFILE("*.XLS", "Selectionnez le fichier")

    oExcel:WorkBooks:Open( cXls)

    oExcel:Visible = .T.


RETURN NIL
 
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Richard,
Richard Chidiak wrote:Enrico

The code below works OK with Harbour if the file exists

I tried it with a file on my disk at it opened ok.

Note : I executed my test program as an administrator

Compiled with Harbour and Msvc

I sent you by email the exe , this way you can check your Harbour configuration also.

Richard

Code: Select all

#INCLUDE "FIVEWIN.CH"

function Main()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL cXls  := CGETFILE("*.XLS", "Selectionnez le fichier")

    oExcel:WorkBooks:Open( cXls)

    oExcel:Visible = .T.


RETURN NIL
 
This is not my sample. Please try my sample as it is. It works fine with xHarbour but not with Harbour (because Harbour doesn't have OleDefaultArg() function).

EMG
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post by nageswaragunupudi »

Harbour doesn't have OleDefaultArg()
Yes.
This is needed very much for porting all our ole & ado apps and libs to Harbour, in complete shape.

We discussed this topic earlier in this thread. but left it before a solution could be found.
http://forums.fivetechsupport.com/viewt ... rg#p146919
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

NageswaraRao,
nageswaragunupudi wrote:
Harbour doesn't have OleDefaultArg()
Yes.
This is needed very much for porting all our ole & ado apps and libs to Harbour, in complete shape.

We discussed this topic earlier in this thread. but left it before a solution could be found.
http://forums.fivetechsupport.com/viewt ... rg#p146919
Yes, I already reviewed it, thank you. :-(

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

Friends, I'd like to know how do you migrate to Harbour if Harbour doesn't support OLE optional parameters.

Am I missing something?

EMG
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post by nageswaragunupudi »

Not many use these features.
It is also possible to find workarounds in some cases.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

NageswaraRao,
nageswaragunupudi wrote:Not many use these features.
It is also possible to find workarounds in some cases.
Is there a workaround to get my sample to work?

EMG
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post by nageswaragunupudi »

Is this your code?

Code: Select all

oExcel:WorkBooks:Open( cXls, , , OLEDEFAULTARG(), , , , OLEDEFAULTARG(), , , .T., , .T. )
You are using OleDefaultArg() for 4th and 8th parameters only and they are Format and Origin.
I refer to
http://msdn.microsoft.com/en-us/library ... 94819.aspx

Parameters:
Open(1.FileName, 2.UpdateLinks, 3.ReadOnly, 4.Format, 5.Password, 6.WriteResPassword, 7.IgnoreReadOnlyRecommended, 8.Origin, 9.Delimiter, 10.Editable, 11.Notify, 12.Converter, 13.AddToMru, 14.Local, 15.CorruptLoad)


Please try numbers 1 to 4 for the 4th parameter and xlWindows (we need to find the numeric value) for the 8th parameter.

I do not know why you want to specify .t. for parameters 11 and 12? Did I count the commas correctly? Or did you intend to specify .t. for params 10 and 11, which are Editable and Notify?

If you can accept the defaults for these last two parameters, it is enough to specify the first parameter alone.
Regards

G. N. Rao.
Hyderabad, India
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Migrating to Harbour

Post by ADutheil »

Rao,

I´ve got these in my excel.ch and a lot more. It´s 1555 lines long.

Code: Select all

#define xlMacintosh 1
#define xlWindows 2
#define xlMSDOS 3
 
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Migrating to Harbour

Post by nageswaragunupudi »

ADutheil wrote:Rao,

I´ve got these in my excel.ch and a lot more. It´s 1555 lines long.

Code: Select all

#define xlMacintosh 1
#define xlWindows 2
#define xlMSDOS 3
 
That's a great collection,
Can you send to me by mail?
nageswaragunupudi@gmail.com
It would be useful to all if we keep it in fwh\include folder
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Migrating to Harbour

Post by Enrico Maria Giordano »

NageswaraRao,
nageswaragunupudi wrote:Is this your code?

Code: Select all

oExcel:WorkBooks:Open( cXls, , , OLEDEFAULTARG(), , , , OLEDEFAULTARG(), , , .T., , .T. )
You are using OleDefaultArg() for 4th and 8th parameters only and they are Format and Origin.
I refer to
http://msdn.microsoft.com/en-us/library ... 94819.aspx

Parameters:
Open(1.FileName, 2.UpdateLinks, 3.ReadOnly, 4.Format, 5.Password, 6.WriteResPassword, 7.IgnoreReadOnlyRecommended, 8.Origin, 9.Delimiter, 10.Editable, 11.Notify, 12.Converter, 13.AddToMru, 14.Local, 15.CorruptLoad)


Please try numbers 1 to 4 for the 4th parameter and xlWindows (we need to find the numeric value) for the 8th parameter.

I do not know why you want to specify .t. for parameters 11 and 12? Did I count the commas correctly? Or did you intend to specify .t. for params 10 and 11, which are Editable and Notify?

If you can accept the defaults for these last two parameters, it is enough to specify the first parameter alone.
That's only a sample. I have a lot of code like that and I'm not willing to review any of those.

Anybody who can suggest the Harbour developers to implement ole optional parameter?

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Migrating to Harbour

Post by Antonio Linares »

Enrico,

Do you just need function OleDefaultArg() ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply