C Struct

Re: C Struct

Postby Antonio Linares » Fri Jun 20, 2014 7:56 pm

Cristobal,

OleDefaultArg() is to OLE quite similar to what NIL is to Harbour :-)
regards, saludos

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

Re: C Struct

Postby cnavarro » Fri Jun 20, 2014 9:03 pm

And the function picks the right type of parameter?
I get it, so no need to take into account all the parameters of filling functions, no?

Y la funcion recoge el tipo de parámetro adecuado?
Ya entiendo, asi no hay que tener en cuenta rellenar todos los parámetros de las funciones, no?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: C Struct

Postby Antonio Linares » Sat Jun 21, 2014 6:09 am

Cristobal,

I have never needed it but I guess so.

Enrico has been using it for long time so surely he may be able to complete my description :-)
regards, saludos

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

Re: C Struct

Postby Enrico Maria Giordano » Sat Jun 21, 2014 7:08 am

Antonio, Cristobal,

Antonio Linares wrote:Cristobal,

I have never needed it but I guess so.

Enrico has been using it for long time so surely he may be able to complete my description :-)


What I know is that some OLE methods fail if OleDefaultArg() is not used for some missing parameters (not necessarily all of them).

Samples:

Code: Select all  Expand view  RUN
oSel:InsertFile( cTmp, OLEDEFAULTARG(), .F. )

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


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

Re: C Struct

Postby nageswaragunupudi » Sat Jun 21, 2014 7:16 am

Antonio Linares wrote:Cristobal,

I have never needed it but I guess so.

Enrico has been using it for long time so surely he may be able to complete my description :-)

I have also been using.
Regards

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

Re: C Struct

Postby cnavarro » Sat Jun 21, 2014 7:25 am

Thanks Enrico, Rao
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: C Struct

Postby nageswaragunupudi » Sat Jun 21, 2014 7:57 am

Anyway the entire discussion started with using C Struct of xHarbour. May be, xHarbour's implementation has some issues.

But FWH also implements C Structures for its own use.
Please refer to struct.ch and tstruct.prg and examples in samples folder.
Using the STRUCT command for C structures for interfacing with Windows API has been working well for FWH.

My be one can use FWH's built in C Struct, instead of xHarbour's C Struct
Regards

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

Re: C Struct

Postby Enrico Maria Giordano » Sat Jun 21, 2014 8:52 am

Rao,

nageswaragunupudi wrote:Anyway the entire discussion started with using C Struct of xHarbour. May be, xHarbour's implementation has some issues.


I need of a reduced and self-contained sample of the problem in order to try to fix it. A sample that I can build and run here. Without it I can't fix anything, sorry.

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

Re: C Struct

Postby Antonio Linares » Sat Jun 21, 2014 1:12 pm

Pat,

As I said at the beginning, when you are going to manage complex C structures, the best way to do it is from C language.

Its really easy, as you don't need to master the C language. With a little example you will be able to understand it and do it yourself :-)

From FWH provided source code (FWH\source\winapi\wndis.c), Just place this code at the bottom of your main PRG:

Code: Select all  Expand view  RUN
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( GETVERSION ) //  --> anVersions
{
      OSVERSIONINFO vi;

      vi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
      GetVersionEx( &vi );

      hb_reta( 5 );

      hb_storvnl( ( long ) vi.dwMajorVersion, -1, 1 );
      hb_storvnl( ( long ) vi.dwMinorVersion, -1, 2 );
      hb_storvnl( ( long ) vi.dwBuildNumber,  -1, 3 );
      hb_storvnl( ( long ) vi.dwPlatformId,   -1, 4 );
      hb_storvc( ( char * ) vi.szCSDVersion,   -1, 5 );
}

#pragma ENDDUMP
 
regards, saludos

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

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 44 guests