Migrating to Harbour

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Sat Oct 05, 2013 4:52 pm

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  Expand view
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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Richard Chidiak » Sat Oct 05, 2013 8:02 pm

Enrico

Please take a look at the excel workbooks property

http://msdn.microsoft.com/en-us/library ... =office.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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Sat Oct 05, 2013 8:44 pm

Richard,

Richard Chidiak wrote:Enrico

Please take a look at the excel workbooks property

http://msdn.microsoft.com/en-us/library ... =office.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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Richard Chidiak » Sat Oct 05, 2013 9:14 pm

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  Expand view

#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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Sat Oct 05, 2013 9:40 pm

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  Expand view

#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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby nageswaragunupudi » Sat Oct 05, 2013 11:23 pm

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.
viewtopic.php?f=3&t=26577&p=146919&hilit=oledefaultarg#p146919
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Sun Oct 06, 2013 9:37 am

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.
viewtopic.php?f=3&t=26577&p=146919&hilit=oledefaultarg#p146919


Yes, I already reviewed it, thank you. :-(

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

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Mon Oct 07, 2013 8:13 pm

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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby nageswaragunupudi » Mon Oct 07, 2013 9:15 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Mon Oct 07, 2013 9:48 pm

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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby nageswaragunupudi » Mon Oct 07, 2013 10:31 pm

Is this your code?
Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Migrating to Harbour

Postby ADutheil » Tue Oct 08, 2013 1:45 am

Rao,

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

Code: Select all  Expand view

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

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Migrating to Harbour

Postby nageswaragunupudi » Tue Oct 08, 2013 1:49 am

ADutheil wrote:Rao,

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

Code: Select all  Expand view

#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
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Migrating to Harbour

Postby Enrico Maria Giordano » Tue Oct 08, 2013 8:34 am

NageswaraRao,

nageswaragunupudi wrote:Is this your code?
Code: Select all  Expand view
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
Enrico Maria Giordano
 
Posts: 8391
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Migrating to Harbour

Postby Antonio Linares » Tue Oct 08, 2013 12:15 pm

Enrico,

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

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

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests