Re: RE : RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support forusinganactivex

2011-06-01 Thread Roberto Padovani
Finally, I've been able to use the activex collection without any
EOleSysException.
I was able to use the collections from Word and Excel, but not from
the dll I had.

FPC 2.5.1   from svn   r17599  fixed it.

Thanks everyone,

  Roberto


2011/5/31 Ludo Brands :
> You can send me the file directly. Address is in the message.
>
> To install fpc from svn: http://wiki.lazarus.freepascal.org/Getting_Lazarus
> has good instructions.
>
> Ludo
>
>
>> -Message d'origine-
>> De : fpc-pascal-boun...@lists.freepascal.org
>> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part
>> de Roberto Padovani
>> Envoyé : mardi 31 mai 2011 17:41
>> À : FPC-Pascal users discussions
>> Objet : Re: RE : RE : RE : RE : RE : RE : RE : RE :
>> [fpc-pascal] support forusinganactivex
>>
>>
>> I triede with fpc 2.4.4 but nothing changes. Would you mind
>> having a look a the full dll with your more recent fpc? By
>> the way, how do I install fpc 2.5.x ?? I might send it to you
>> privately; the only trouble is that you don't have a real
>> hardware to connect it, even if the transducers class are
>> created during the main device creation and their count and status are
>> (should) always be available even if not connected.
>>
>> A test case would simply:
>> 1) createoleobject  //OK
>> 2) object.transducers.count // OK, always 8
>> 3) object.transducers(1).Status   //    should be an integer, not
>> a crash !!!
>>
>> R#
>>
>>
>> 2011/5/31 Roberto Padovani :
>> > Thanks, I'll try installing a more recent fpc and lazarus...
>> >
>> >
>> >
>> > 2011/5/30 Ludo Brands :
>> >> I created a small automation object with following IDL
>> (part of it):
>> >>
>> >>   interface ItestAX: IDispatch
>> >>  {
>> >>    [
>> >>    propget,
>> >>    id(0x0001)
>> >>    ]
>> >>    HRESULT _stdcall Devices([out, retval] IDevices ** Value );
>> >>  };
>> >>
>> >>   interface IIDevices: IDispatch
>> >>  {
>> >>    [
>> >>    propget,
>> >>    id(0x)
>> >>    ]
>> >>    HRESULT _stdcall Device([in] long Idx, [out, retval] IDevice **
>> >> Value );
>> >>    [
>> >>    propget,
>> >>    id(0x0002)
>> >>    ]
>> >>    HRESULT _stdcall Count([out, retval] long * Value );
>> >>  };
>> >>
>> >>   interface IIDevice: IDispatch
>> >>  {
>> >>    [
>> >>    propget,
>> >>    id(0x0001)
>> >>    ]
>> >>    HRESULT _stdcall Name([out, retval] BSTR * Value );
>> >>  };
>> >>
>> >> This matches pretty much the interface you described earlier. Note
>> >> the
>> >> id(0x) which makes Device the default member of
>> IIDevices. This is
>> >> the same as id(DISPID_VALUE) in your case.
>> >>
>> >> Now, the following lines do work for me to get the Name member of
>> >> IIDevice
>> >> (ActX,a,b:variant;s:string):
>> >>
>> >>  ActX:=CreateOleObject(MyTestControl);
>> >>  a:=ActX.Devices;
>> >>  b:=a.Device[3];
>> >>  s:=b.Name;
>> >>  b:=ActX.Devices.Device[3];
>> >>  s:=b.Name;
>> >>  b:=ActX.Devices[3];
>> >>  s:=b.Name;
>> >>
>> >> Note that the default member does work correctly:
>> >> Devices.Device[3]===Devices[3].
>> >>
>> >> I'm using fpc 2.5.1 svn 17599.
>> >>
>> >> Ludo
>> >>
>> >> ___
>> >> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>> >>
>> >
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for usinganactivex

2011-05-31 Thread Roberto Padovani
I triede with fpc 2.4.4 but nothing changes. Would you mind having a
look a the full dll with your more recent fpc?
By the way, how do I install fpc 2.5.x ??
I might send it to you privately; the only trouble is that you don't
have a real hardware to connect it, even if the transducers class are
created during the main device creation and their count and status are
(should) always be available even if not connected.

A test case would simply:
1) createoleobject  //OK
2) object.transducers.count // OK, always 8
3) object.transducers(1).Status   //    should be an integer, not
a crash !!!

R#


2011/5/31 Roberto Padovani :
> Thanks, I'll try installing a more recent fpc and lazarus...
>
>
>
> 2011/5/30 Ludo Brands :
>> I created a small automation object with following IDL (part of it):
>>
>>   interface ItestAX: IDispatch
>>  {
>>    [
>>    propget,
>>    id(0x0001)
>>    ]
>>    HRESULT _stdcall Devices([out, retval] IDevices ** Value );
>>  };
>>
>>   interface IIDevices: IDispatch
>>  {
>>    [
>>    propget,
>>    id(0x)
>>    ]
>>    HRESULT _stdcall Device([in] long Idx, [out, retval] IDevice ** Value );
>>    [
>>    propget,
>>    id(0x0002)
>>    ]
>>    HRESULT _stdcall Count([out, retval] long * Value );
>>  };
>>
>>   interface IIDevice: IDispatch
>>  {
>>    [
>>    propget,
>>    id(0x0001)
>>    ]
>>    HRESULT _stdcall Name([out, retval] BSTR * Value );
>>  };
>>
>> This matches pretty much the interface you described earlier. Note the
>> id(0x) which makes Device the default member of IIDevices. This is
>> the same as id(DISPID_VALUE) in your case.
>>
>> Now, the following lines do work for me to get the Name member of IIDevice
>> (ActX,a,b:variant;s:string):
>>
>>  ActX:=CreateOleObject(MyTestControl);
>>  a:=ActX.Devices;
>>  b:=a.Device[3];
>>  s:=b.Name;
>>  b:=ActX.Devices.Device[3];
>>  s:=b.Name;
>>  b:=ActX.Devices[3];
>>  s:=b.Name;
>>
>> Note that the default member does work correctly:
>> Devices.Device[3]===Devices[3].
>>
>> I'm using fpc 2.5.1 svn 17599.
>>
>> Ludo
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for usinganactivex

2011-05-30 Thread Roberto Padovani
Thanks, I'll try installing a more recent fpc and lazarus...



2011/5/30 Ludo Brands :
> I created a small automation object with following IDL (part of it):
>
>   interface ItestAX: IDispatch
>  {
>    [
>    propget,
>    id(0x0001)
>    ]
>    HRESULT _stdcall Devices([out, retval] IDevices ** Value );
>  };
>
>   interface IIDevices: IDispatch
>  {
>    [
>    propget,
>    id(0x)
>    ]
>    HRESULT _stdcall Device([in] long Idx, [out, retval] IDevice ** Value );
>    [
>    propget,
>    id(0x0002)
>    ]
>    HRESULT _stdcall Count([out, retval] long * Value );
>  };
>
>   interface IIDevice: IDispatch
>  {
>    [
>    propget,
>    id(0x0001)
>    ]
>    HRESULT _stdcall Name([out, retval] BSTR * Value );
>  };
>
> This matches pretty much the interface you described earlier. Note the
> id(0x) which makes Device the default member of IIDevices. This is
> the same as id(DISPID_VALUE) in your case.
>
> Now, the following lines do work for me to get the Name member of IIDevice
> (ActX,a,b:variant;s:string):
>
>  ActX:=CreateOleObject(MyTestControl);
>  a:=ActX.Devices;
>  b:=a.Device[3];
>  s:=b.Name;
>  b:=ActX.Devices.Device[3];
>  s:=b.Name;
>  b:=ActX.Devices[3];
>  s:=b.Name;
>
> Note that the default member does work correctly:
> Devices.Device[3]===Devices[3].
>
> I'm using fpc 2.5.1 svn 17599.
>
> Ludo
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using anactivex

2011-05-30 Thread Roberto Padovani
With the round bracketitem := items.item(1);
it crasches saying "Cannot find member"

I am declaring only variants as you suggestedmaybe for collections
I have to declare explicitely some interfaces? I tried without
success, but not knowing COM at all, I might have written something
wrong.

I've seen around variants and olevariants...??
Could it be an error or non-standard implementation of the dll ?

I'm loosing confidence.

Thanks anyway!!

R#


2011/5/30 Ludo Brands :
> Use Item(i). Item(long Index, [out, retval] ITransducer* *pVal); means
> method with 1 input Index and Output Itransducer^.
>
> Ludo
>
>> -Message d'origine-
>> De : fpc-pascal-boun...@lists.freepascal.org
>> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part
>> de Roberto Padovani
>> Envoyé : lundi 30 mai 2011 14:16
>> À : FPC-Pascal users discussions
>> Objet : Re: RE : RE : RE : RE : RE : RE : [fpc-pascal]
>> support for using anactivex
>>
>>
>> Hi Ludo,
>>
>> I really cannot get the items to work. I simplyfied the
>> source code to the minimum in order to test the items stuff.
>>
>> var   obj, item, items : variant;
>>
>> obj := CreateOleObject('WRGactiveX.Device');      // OK
>> items := obj.Transducers;                                   // OK
>> writeln('Count: ', items.Count);                             // OK ,
>> always prints 8
>>
>> item := items.item[1];             // Crash: EOleSysError : Numero di
>> parametri non valido.
>>
>> Where the exception comment translates to "wrong number of
>> parameters". Instead, writing item := items[1]  gives the
>> exception EVariantInvalidArgError : Invalid argument: Dispatch
>>
>> In the activex source code I hav these interface declarations:
>>
>> interface ITransducer : IDispatch
>>       {
>>               [propget, id(1), helpstring("property Name")]
>> HRESULT Name([out, retval] BSTR *pVal);
>>               [propget, id(2), helpstring("property Status")]
>> HRESULT Status([out, retval] WRG_TransdStatus *pVal);
>>               [propget, id(4), helpstring("property Meas")]
>> HRESULT Meas([out, retval] double *pVal);
>>       };
>>
>> interface ITransducers : IDispatch
>>       {
>>               [propget, id(1), helpstring("property Count")]
>> HRESULT Count([out, retval] long *pVal);
>>               [propget, id(DISPID_VALUE),
>> helpstring("property Item")] HRESULT Item(long Index, [out,
>> retval] ITransducer* *pVal);
>>               [propget, id(DISPID_NEWENUM),
>> helpstring("property _NewEnum"), hidden] HRESULT
>> _NewEnum([out, retval] LPUNKNOWN *pVal);
>>       };
>>
>> and used inside the IDevice class like:
>>
>>               [propget, id(21), helpstring("property
>> Transducers")] HRESULT Transducers([out, retval] ITransducers* *pVal);
>>
>>
>> I would be very grateful if you could help me once more.
>>
>> Roberto
>>
>>
>>
>> 2011/5/25 Ludo Brands :
>> > Using variants you can transparently "walk" along the
>> exposed objects.
>> > The variant contains the Idispatch of the object and gets
>> the exposed
>> > methods at runtime. Properties are implemented as get and
>> put methods
>> > or just get methods for read only properties.
>> >
>> > If you have something like
>> > Itransducers = interface
>> >  ..
>> >  property transducer[Index:integer]:Itransducer;
>> > end;
>> >
>> > Then you would do
>> > transducer := transducers.transducer[index];
>> >
>> > transducer := transducers[index];  works only if transducer is the
>> > default property for Itransducers. I'm not sure if fpc
>> supports this.
>> >
>> > Ludo
>> >
>> >
>> > -Message d'origine-
>> > De : fpc-pascal-boun...@lists.freepascal.org
>> > [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part
>> de Roberto
>> > Padovani Envoyé : mercredi 25 mai 2011 19:34
>> > À : FPC-Pascal users discussions
>> > Objet : Re: RE : RE : RE : RE : RE : [fpc-pascal] support
>> for using an
>> > activex
>> >
>> >
>> > 2011/5/25 Ludo Brands :
>> >> The code in article
>> >>
>> http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes
>> >> a long way in doing what you want to do.

Re: RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-30 Thread Roberto Padovani
Hi Ludo,

I really cannot get the items to work. I simplyfied the source code to
the minimum in order to test the items stuff.

var   obj, item, items : variant;

obj := CreateOleObject('WRGactiveX.Device');  // OK
items := obj.Transducers;   // OK
writeln('Count: ', items.Count); // OK ,
always prints 8

item := items.item[1]; // Crash: EOleSysError : Numero di
parametri non valido.

Where the exception comment translates to "wrong number of parameters".
Instead, writing item := items[1]  gives the exception
EVariantInvalidArgError : Invalid argument: Dispatch

In the activex source code I hav these interface declarations:

interface ITransducer : IDispatch
{
[propget, id(1), helpstring("property Name")] HRESULT Name([out,
retval] BSTR *pVal);
[propget, id(2), helpstring("property Status")] HRESULT 
Status([out,
retval] WRG_TransdStatus *pVal);
[propget, id(4), helpstring("property Meas")] HRESULT Meas([out,
retval] double *pVal);
};

interface ITransducers : IDispatch
{
[propget, id(1), helpstring("property Count")] HRESULT 
Count([out,
retval] long *pVal);
[propget, id(DISPID_VALUE), helpstring("property Item")] HRESULT
Item(long Index, [out, retval] ITransducer* *pVal);
[propget, id(DISPID_NEWENUM), helpstring("property _NewEnum"),
hidden] HRESULT _NewEnum([out, retval] LPUNKNOWN *pVal);
};

and used inside the IDevice class like:

[propget, id(21), helpstring("property Transducers")] HRESULT
Transducers([out, retval] ITransducers* *pVal);


I would be very grateful if you could help me once more.

Roberto



2011/5/25 Ludo Brands :
> Using variants you can transparently "walk" along the exposed objects. The
> variant contains the Idispatch of the object and gets the exposed methods at
> runtime. Properties are implemented as get and put methods or just get
> methods for read only properties.
>
> If you have something like
> Itransducers = interface
>  ..
>  property transducer[Index:integer]:Itransducer;
> end;
>
> Then you would do
> transducer := transducers.transducer[index];
>
> transducer := transducers[index];  works only if transducer is the default
> property for Itransducers. I'm not sure if fpc supports this.
>
> Ludo
>
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : mercredi 25 mai 2011 19:34
> À : FPC-Pascal users discussions
> Objet : Re: RE : RE : RE : RE : RE : [fpc-pascal] support for using an
> activex
>
>
> 2011/5/25 Ludo Brands :
>> The code in article
>> http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes a
>> long way in doing what you want to do. Unit Eventsink does pretty much
>> of the legwork. You should remove the procedure register since that is
>> the Delphi way to get a component on the toolbar. Remove also the
>> {$IFDEF VER100} and {$ENDIF}. The unit actually includes the code for
>> InterfaceConnect!!
>
> found that! great!
>
>
>> As for the tlb conversion, in your case
>>
>> IEventIntfEvents = dispinterface
>>  ['{168F5642-5751-49F5-9AA4-B8A7A5F6A5B8}']
>>  end;
>>
>> should do (that is for the events part). AFAIK the procedure and
>> dispid definitions are only needed for the server. You are only
>> concerned with dispid's. No need to create prototypes for
>> OnCommChanged() etc. EventSink1Invoke would be a simple case DispID of
>>  1: // do CommChanged
>>  2: // do StatesChanged
>> ...
>> end;
>>
>>
>
> Now I am "wasting" time making the tlb pascal definitions.
> For the event part I'm fine with the dispid's
> Until now I was calling the activex method with variants, in and out, but
> now I discovered that this IDevice class has a property like: property
> Sensors: ISensors;
> which inside is a list of items like   Sensor: ISensor.
>
> Can I read the sensores with a variant? Then, to see the fields inside each
> sensor, I think a I need a class to do that... The activex has all of these
> classes with the suitable dispinterfaces and uuids and so on. But if I
> define
>     var device, transducers, transducer : variant;
> and create
>     device := CreateOleObject('Device');
> then, can i simply write the following ?
>     transducers := device.Transducers;
>     transducer := transducers[index];
>
>
> It's a long path until

Re: RE : RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support forusinganactivex

2011-05-27 Thread Roberto Padovani
2011/5/27 Ludo Brands :
> There is no standard way of getting the information directly from the
> activex object. You can ask your collegues to implement these properties
> (should be straightforeward).

Last time I (hardware engineer) asked for a minor change in a library,
they estimated 2 years work.
For every electronic board I design, I also write 3 or 4 software to
test it, so I'm sure it was a minor change.

> For activex objects that are installed on your computer you can find the
> info here:
> HKEY_CLASSES_ROOT\CLSID\clsid-of-your-object\    (helpstring)
> HKEY_CLASSES_ROOT\CLSID\clsid-of-your-object\version\   (version)
>

I'll go for the registry! Thanks!

> Ludo
>
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : vendredi 27 mai 2011 13:47
> À : FPC-Pascal users discussions
> Objet : Re: RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support
> forusinganactivex
>
>
> It's nearly finished and nearly working.
> I was wondering this: is there a way to query the version and helpstring of
> an activex, once I created it ?
>
> R#
>
> 2011/5/26 Ludo Brands :
>> GetActiveOleObject raises EOleSysError if it fails.
>>
>> -Message d'origine-
>> De : fpc-pascal-boun...@lists.freepascal.org
>> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
>> Padovani Envoyé : jeudi 26 mai 2011 17:32
>> À : FPC-Pascal users discussions
>> Objet : Re: RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for
>> usinganactivex
>>
>>
>> Wow, thanks again for the explanation and the example!
>> I'm working on thatand it starts beating
>>
>> By the way, after this:
>>
>> FDevice := GetActiveOleObject(OLE_OBJECT_NAME);
>>
>> how can i test that everything is ok and FDevice is valid ? something
>> like:
>>
>> ok := FDevice <> nil;
>>
>> Roberto
>>
>> 2011/5/26 Ludo Brands :
>>> Attached a small lazarus demo project that implements the EventSink
>>> unit. It is based on the EventSink unit in the article and adapted
>>> for fpc. The demo launches Msword and connects to the
>>> ApplicationEvents interface {000209F7---C000-0046}.
>>> When you create a new document, or change document, close word etc.
>>> in msword the app displays in a memo the dispids received through the
>>> event sink.
>>>
>>> As you will notice, the dispinterface for the events interface just
>>> contains the guid. No method prototypes are required.
>>>
>>> Ludo
>>>
>>>
>>> ___
>>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for usinganactivex

2011-05-27 Thread Roberto Padovani
It's nearly finished and nearly working.
I was wondering this: is there a way to query the version and
helpstring of an activex, once I created it ?

R#

2011/5/26 Ludo Brands :
> GetActiveOleObject raises EOleSysError if it fails.
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : jeudi 26 mai 2011 17:32
> À : FPC-Pascal users discussions
> Objet : Re: RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for
> usinganactivex
>
>
> Wow, thanks again for the explanation and the example!
> I'm working on thatand it starts beating
>
> By the way, after this:
>
> FDevice := GetActiveOleObject(OLE_OBJECT_NAME);
>
> how can i test that everything is ok and FDevice is valid ? something like:
>
> ok := FDevice <> nil;
>
> Roberto
>
> 2011/5/26 Ludo Brands :
>> Attached a small lazarus demo project that implements the EventSink
>> unit. It is based on the EventSink unit in the article and adapted for
>> fpc. The demo launches Msword and connects to the ApplicationEvents
>> interface {000209F7---C000-0046}. When you create a
>> new document, or change document, close word etc. in msword the app
>> displays in a memo the dispids received through the event sink.
>>
>> As you will notice, the dispinterface for the events interface just
>> contains the guid. No method prototypes are required.
>>
>> Ludo
>>
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using anactivex

2011-05-26 Thread Roberto Padovani
Wow, thanks again for the explanation and the example!
I'm working on thatand it starts beating

By the way, after this:

FDevice := GetActiveOleObject(OLE_OBJECT_NAME);

how can i test that everything is ok and FDevice is valid ? something like:

ok := FDevice <> nil;

Roberto

2011/5/26 Ludo Brands :
> Attached a small lazarus demo project that implements the EventSink unit. It
> is based on the EventSink unit in the article and adapted for fpc.
> The demo launches Msword and connects to the ApplicationEvents interface
> {000209F7---C000-0046}. When you create a new document, or
> change document, close word etc. in msword the app displays in a memo the
> dispids received through the event sink.
>
> As you will notice, the dispinterface for the events interface just contains
> the guid. No method prototypes are required.
>
> Ludo
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
Always thanks!

Given your evident experience on this matter, I kindly ask your advice
on what is best to do.

opt 1) create a fpc class with some pascal style methods, which in
their implementation use variants and call the IDevice class with
late-binding . meaning that there is no compiler check and if my
collegue changes the dll, then I have to change these implementations

opt 2) in a reference of those you sent me, there is some example code
from which I take the lines below. In the tlb conversion unit, the
interface and dispinterface of the class are some replicated. Then
also the eventinterface is defined.
The main interface class is defined without and with dispids. With the
dispids, only the properties are defined and not the methods.

  IFileZapper = interface(IDispatch)
['{2E2FC5E0-5C0E-4C4F-8CC1-D9F6C5A92BA6}']
function Get_Directory: WideString; safecall;
procedure Set_Directory(const Value: WideString); safecall;
function Get_FileMask: WideString; safecall;
procedure Set_FileMask(const Value: WideString); safecall;
procedure BringToFront; safecall;
property Directory: WideString read Get_Directory write Set_Directory;
property FileMask: WideString read Get_FileMask write Set_FileMask;
  end;

  IFileZapperDisp = dispinterface
['{2E2FC5E0-5C0E-4C4F-8CC1-D9F6C5A92BA6}']
property Directory: WideString dispid 1;
property FileMask: WideString dispid 3;
procedure BringToFront; dispid 10;
  end;

  IFileZapperEvents = dispinterface
['{7B6F8ADD-7980-4A35-838B-E1600C43D29E}']
procedure OnSelectionChanged; dispid 1;
procedure OnDirectoryChanged(const DirName: WideString); dispid 2;
  end;

Is this somewhat the same thing as the wrapper of option 1? If I write
all of this conversion (and, by the way, how to convert C++ data types
to pascal?? widestring ?), then how can I use it?

In the end, maybe the wiki page about COM interfaces should be update
to something more than 'Word.Application.NewFile'.
I can't share the activex I have, otherwise it would be a good example
to see something useful to start with.

Roberto

2011/5/25 Ludo Brands :
> Using variants you can transparently "walk" along the exposed objects. The
> variant contains the Idispatch of the object and gets the exposed methods at
> runtime. Properties are implemented as get and put methods or just get
> methods for read only properties.
>
> If you have something like
> Itransducers = interface
>  ..
>  property transducer[Index:integer]:Itransducer;
> end;
>
> Then you would do
> transducer := transducers.transducer[index];
>
> transducer := transducers[index];  works only if transducer is the default
> property for Itransducers. I'm not sure if fpc supports this.
>
> Ludo
>
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : mercredi 25 mai 2011 19:34
> À : FPC-Pascal users discussions
> Objet : Re: RE : RE : RE : RE : RE : [fpc-pascal] support for using an
> activex
>
>
> 2011/5/25 Ludo Brands :
>> The code in article
>> http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes a
>> long way in doing what you want to do. Unit Eventsink does pretty much
>> of the legwork. You should remove the procedure register since that is
>> the Delphi way to get a component on the toolbar. Remove also the
>> {$IFDEF VER100} and {$ENDIF}. The unit actually includes the code for
>> InterfaceConnect!!
>
> found that! great!
>
>
>> As for the tlb conversion, in your case
>>
>> IEventIntfEvents = dispinterface
>>  ['{168F5642-5751-49F5-9AA4-B8A7A5F6A5B8}']
>>  end;
>>
>> should do (that is for the events part). AFAIK the procedure and
>> dispid definitions are only needed for the server. You are only
>> concerned with dispid's. No need to create prototypes for
>> OnCommChanged() etc. EventSink1Invoke would be a simple case DispID of
>>  1: // do CommChanged
>>  2: // do StatesChanged
>> ...
>> end;
>>
>>
>
> Now I am "wasting" time making the tlb pascal definitions.
> For the event part I'm fine with the dispid's
> Until now I was calling the activex method with variants, in and out, but
> now I discovered that this IDevice class has a property like: property
> Sensors: ISensors;
> which inside is a list of items like   Sensor: ISensor.
>
> Can I read the sensores with a variant? Then, to see the fields inside each
> sensor, I think a I need a class to do that... The activex has all of these
> classes with the suitable dispinterfaces and uuids and so on. But if I
> define

Re: RE : RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/25 Ludo Brands :
> The code in article
> http://www.informit.com/articles/article.aspx?p=130494&seqNum=5 goes a long
> way in doing what you want to do. Unit Eventsink does pretty much of the
> legwork. You should remove the procedure register since that is the Delphi
> way to get a component on the toolbar. Remove also the {$IFDEF VER100} and
> {$ENDIF}. The unit actually includes the code for InterfaceConnect!!

found that! great!


> As for the tlb conversion, in your case
>
> IEventIntfEvents = dispinterface
>  ['{168F5642-5751-49F5-9AA4-B8A7A5F6A5B8}']
>  end;
>
> should do (that is for the events part). AFAIK the procedure and dispid
> definitions are only needed for the server. You are only concerned with
> dispid's. No need to create prototypes for OnCommChanged() etc.
> EventSink1Invoke would be a simple
> case DispID of
>  1: // do CommChanged
>  2: // do StatesChanged
> ...
> end;
>
>

Now I am "wasting" time making the tlb pascal definitions.
For the event part I'm fine with the dispid's
Until now I was calling the activex method with variants, in and out,
but now I discovered that this IDevice class has a property like:
property Sensors: ISensors;
which inside is a list of items like   Sensor: ISensor.

Can I read the sensores with a variant? Then, to see the fields inside
each sensor, I think a I need a class to do that...
The activex has all of these classes with the suitable dispinterfaces
and uuids and so on. But if I define
 var device, transducers, transducer : variant;
and create
 device := CreateOleObject('Device');
then, can i simply write the following ?
 transducers := device.Transducers;
 transducer := transducers[index];


It's a long path until I get this stuff working...

R#
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/25 Ludo Brands :
> Regarding the tlb to pascal "conversion", AFAIK there is no support in fpc.
> Delphi is clearly better equiped to work with COM objects.
>
> I have also been playing around with a generic eventsink class but the
> problem is that events can have parameters (and a lot do). Your suggestion
> of using TNotifyEvents could work for events without parameters. You could
> leave the parameter stuff to the user of the eventsink, eventually helping
> him by exposing the number and type of parameters, but that means that the
> user has to have a reasonable good understanding of COM, including the data
> types compatible with COM marshalling.
>

Thanks for the explanation. In fact, that is the reason why I called
it TSimpleEventSink, meaning that it was good for simple situation.
In my case, for example, the activex controls a hardware stuff which
only request the user to take an action sometimes.
In the C++ source code for the class Device I have:

[
uuid(168F5642-5751-49F5-9AA4-B8A7A5F6A5B8),
helpstring("_IDeviceEvents Interface")
]
dispinterface _IDeviceEvents
{
properties:
methods:
[id(1), helpstring("method OnCommChanged")] HRESULT OnCommChanged();
[id(2), helpstring("method OnStatesChanged")] HRESULT OnStatesChanged();
[id(3), helpstring("method OnContact")] HRESULT OnContact();
[id(4), helpstring("method OnMeasUpdate")] HRESULT OnMeasUpdate();
};

where this four simple events only alert the user about a change
situation; then the user takes the suitable actions.
Do you think it could work for me?

Now I'm trying to write by hand a minimalist tlb, looking for the
definitions in the activex source code

Thanks a lot!!

  Roberto
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : [fpc-pascal] support for using an activex

2011-05-25 Thread Roberto Padovani
2011/5/24 Ludo Brands :
> The following delphi articles should help creating an event sink:
>
> http://www.informit.com/articles/article.aspx?p=130494&seqNum=5  This is an
> interesting one since it is written for Delphi 3-4 which missed a lot of the
> automated COM handling. This is much closer to where fpc is now.
>
> http://www.blong.com/Conferences/IConUK2000/DelphiMoreAutomation/More%20Auto
> mation%20In%20Delphi.htm#HandcraftedEventSink
>
> A good intruduction to connectable objects:
> http://www.gtro.com/delphi/comevents_e.php
>

Thanks a lot!

I'm reading it all and writing some code.
But in all of those docs there the "InterfaceConnect" routine is
usedbut I can't find it anywhere.
Besides, is there something to convert the tlb to pascal? Or shall I
do it manually?

I might be wrong, but it seems to me that it should be possible to
write a general TSimpleEventSink class which does most of all the COM
work, and exposes a pascal-standard event management.
The TSimpleEventSink class might have an Events property which is a
dynamic array of TNotifyEvents; the client could resize it and link
its event handlers. At the same time the TSimpleEventSink reacts to
the server events by mapping the dispid's to the Events array index,
up to its current maximum dimension.

Well, I'm still quite confused besides the missing
InterfaceConnect method, is there any freepascal example available?
On the web I can only find delphi ones.

Thanks,

  Roberto
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] support for using an activex

2011-05-24 Thread Roberto Padovani
Thanks a lot!
I've been able to create the object and connect to my device.. and
even reading some strings!
This FPC + ActiveX stuff is really cool.

> Don't know if your ActiveX sends events that you want to catch. Creating
> "event sinks" is relatively complex.
>

Yes, the most important thing is fired as an event. So, at least, I
have to try that...

> Com reference information can be found here:
> http://msdn.microsoft.com/en-us/library/ms221375.aspx
>

Basically, I didn't understand anything over there. Probably I should
read a lot more of docs, but also the content organization is not
clear to me.

Does anyone have a code example of this "event sinking" ?

Thanks anyway,

  Roberto


> Ludo
>
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : lundi 23 mai 2011 15:07
> À : FPC-Pascal users discussions
> Objet : Re: RE : [fpc-pascal] support for using an activex
>
>
> Wow, this sound like good news!
>
> The activex I have is not visual; it is "simply" a class that creates a
> thread in which a physical device is controlled through a serial port, with
> a particular protocol. The class then has methods like "Open channel", "Read
> Mesaure", and so on.
>
> Is there any documentation I can read? I think I have to translate some
> header files to understand the exchanged data...or shall I use only variant
> ?
> I suppose I have to change   MSWord :=
> CreateOleObject('Word.Application');   into something related to my
> class; where do I discover the "name.surname" ?
>
> Thanks all!
>
>
> 2011/5/23 Ludo Brands :
>> If the activex is not a visual control that you want to put on a LCL
>> form you can use CreateOleObject. Note that you don't load ActiveX
>> dll's directly. ActiveX objects are registered in Windows by the
>> installer or manually with Regsvr32.exe. Windows loads the ddl for you
>> when you call CreateOleObject. Ole components are reference counted
>> and released when not used anymore.
>>
>> Here is a simple sample program when you have MS Word installed.
>>
>>
>> program Project1;
>>
>> {$mode objfpc}{$H+}
>>
>> uses
>>  {$IFDEF UNIX}{$IFDEF UseCThreads}
>>  cthreads,
>>  {$ENDIF}{$ENDIF}
>>  Classes
>>  { you can add units after this }
>>  ,sysutils,ComObj;
>>
>> {$R *.res}
>>
>> var
>>  MSWord,WordDoc,WordPara: Variant;
>> begin
>>  MSWord := CreateOleObject('Word.Application');
>>  MSWord.Visible:=true;
>>  WordDoc := MSWord.Documents.Add;
>>  WordDoc.Activate;
>>  WordPara := WordDoc.Content.Paragraphs.Add;
>>  WordPara.Range.Text := 'Hello World!';
>>  WordDoc.SaveAs('C:\Test.Doc');
>>  Sleep(1);
>>  WordDoc.Close(False);
>>  MSWord.Quit;
>>  MSWord := Unassigned;
>>  WordDoc := Unassigned;
>>  WordPara := Unassigned;
>> end.
>>
>>
>>
>> -Message d'origine-
>> De : fpc-pascal-boun...@lists.freepascal.org
>> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
>> Padovani Envoyé : lundi 23 mai 2011 12:24
>> À : FPC-Pascal users discussions
>> Objet : [fpc-pascal] support for using an activex
>>
>>
>> Hi List!
>>
>> I looked around the archives and forum, but I didn't come up with a
>> clear answer. Besides, I'm not expert of the win32 and COM world.
>>
>> If I am given an ActiveX, with source code included, is it possible to
>> using from a freepascal / lazarus app like any other dll? I mean
>> loading the dll, instantiating the object and calling some methods.
>>
>> If so, can anyone point me to some documentation or example?
>>
>> Thanks a lot,
>>
>>  Roberto
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : [fpc-pascal] support for using an activex

2011-05-23 Thread Roberto Padovani
Wow, this sound like good news!

The activex I have is not visual; it is "simply" a class that creates
a thread in which a physical device is controlled through a serial
port, with a particular protocol. The class then has methods like
"Open channel", "Read Mesaure", and so on.

Is there any documentation I can read? I think I have to translate
some header files to understand the exchanged data...or shall I use
only variant ?
I suppose I have to change   MSWord :=
CreateOleObject('Word.Application');   into something related to my
class; where do I discover the "name.surname" ?

Thanks all!


2011/5/23 Ludo Brands :
> If the activex is not a visual control that you want to put on a LCL form
> you can use CreateOleObject. Note that you don't load ActiveX dll's
> directly. ActiveX objects are registered in Windows by the installer or
> manually with Regsvr32.exe. Windows loads the ddl for you when you call
> CreateOleObject. Ole components are reference counted and released when not
> used anymore.
>
> Here is a simple sample program when you have MS Word installed.
>
>
> program Project1;
>
> {$mode objfpc}{$H+}
>
> uses
>  {$IFDEF UNIX}{$IFDEF UseCThreads}
>  cthreads,
>  {$ENDIF}{$ENDIF}
>  Classes
>  { you can add units after this }
>  ,sysutils,ComObj;
>
> {$R *.res}
>
> var
>  MSWord,WordDoc,WordPara: Variant;
> begin
>  MSWord := CreateOleObject('Word.Application');
>  MSWord.Visible:=true;
>  WordDoc := MSWord.Documents.Add;
>  WordDoc.Activate;
>  WordPara := WordDoc.Content.Paragraphs.Add;
>  WordPara.Range.Text := 'Hello World!';
>  WordDoc.SaveAs('C:\Test.Doc');
>  Sleep(1);
>  WordDoc.Close(False);
>  MSWord.Quit;
>  MSWord := Unassigned;
>  WordDoc := Unassigned;
>  WordPara := Unassigned;
> end.
>
>
>
> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org
> [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Roberto
> Padovani
> Envoyé : lundi 23 mai 2011 12:24
> À : FPC-Pascal users discussions
> Objet : [fpc-pascal] support for using an activex
>
>
> Hi List!
>
> I looked around the archives and forum, but I didn't come up with a clear
> answer. Besides, I'm not expert of the win32 and COM world.
>
> If I am given an ActiveX, with source code included, is it possible to using
> from a freepascal / lazarus app like any other dll? I mean loading the dll,
> instantiating the object and calling some methods.
>
> If so, can anyone point me to some documentation or example?
>
> Thanks a lot,
>
>  Roberto
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] support for using an activex

2011-05-23 Thread Roberto Padovani
Hi List!

I looked around the archives and forum, but I didn't come up with a
clear answer.
Besides, I'm not expert of the win32 and COM world.

If I am given an ActiveX, with source code included, is it possible to
using from a freepascal / lazarus app like any other dll?
I mean loading the dll, instantiating the object and calling some methods.

If so, can anyone point me to some documentation or example?

Thanks a lot,

  Roberto
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpGUI Toolkit v0.7-rc1 for FPC 2.4

2010-04-12 Thread Roberto Padovani
2010/4/11 Graeme Geldenhuys :
> On 11 April 2010 21:47, Roberto Padovani  wrote:
>>
>> for the virtualization, the problem is the absence of the drivers for
>> most of the pc hardware unless you happen to have a pc with the
>> very few types of devices used in macs.
>
> Well, virtualization software like VirtualBox "fakes" it's own
> hardware - I'm hoping the faked hardware is similar to a real Mac. My
> real PC is Intel based (Quad Core), graphics card is a average ATI or
> Nvidia card. I believe real Mac's use similar hardware.
>
>> You don't need to proof anything to buy it, but consider that:
>
> Good.
>
>
>> - it is expressly forbidden by the license to install on a non-Apple
>> assembled hardware
>
> I do not care about such rubbish license restrictions, and I don't
> believe such a license is valid in my country either (South Africa).
>

I didn't intend to be a moralist, I was just pointing it out. With
this very same purpouse, I'll point out another one.
Even though I own a Mac, so I was only moved by curiosity, I also
thought that such a restriction might not be valid in my country
(Italy).
However, after researching a while, I made up the idea that there are
no specific national limits about these kinds of agreements in the
license and that only international anti-trust and trade regulations
apply. I'm no lawyer, but for what I read those regulations forbid a
hardware manufacturer to force you to use only his software (i.e. you
are allowed to install win XP on the mac you have bought), but not the
contrary (i.e. I give you my software but it is only for XYZ
hardware).

R.

>
>> - you can easily find used mac mini's, if the 500€ new one are out of budget
>
> This might also be a good path to follow. Thanks for pointing it out.
>
>
> --
> Regards,
>  - Graeme -
>
>
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpGUI Toolkit v0.7-rc1 for FPC 2.4

2010-04-11 Thread Roberto Padovani
2010/4/11 Graeme Geldenhuys :
> On 10 April 2010 19:20, Schindler Karl-Michael
>  wrote:
>>
>> I tried a bit more using colorlistbox. But what would be as simple as 
>> possible X11 examples? working with gdb is quite tedious.
>>
>
> >From fpGUI point of view, simply creating a single main window with
> nothing in it. A lot still happens in the background, and that is
> where the Mac+X11 problems are.
>
> If you wanted a Object Pascal example of talking directly to Xlib to
> create a GUI X11 application, I can do that. I have a few test apps
> like that at work. I'll post one on Monday when I am back in the
> office.
>
> It's pretty hard trying to implement a platform I don't have hardware
> or software for. I'll try and see if it is possible to install Mac OS
> in a VirtualBox session - not sure if this is possible. I'll Google
> for more information. Is one allowed to buy Mac OS-X without actually
> owning a Mac? Will the iStore or general computer shop actually ask
> for proof of Mac hardware?
>

for the virtualization, the problem is the absence of the drivers for
most of the pc hardware unless you happen to have a pc with the
very few types of devices used in macs.
You don't need to proof anything to buy it, but consider that:
- it is expressly forbidden by the license to install on a non-Apple
assembled hardware
- you can't buy a cheap upgrade, but you need a full os install 10.5 +
the snow leopard upgrade (i.e. i think there is no full 10.6 on the
market)
- you can easily find used mac mini's, if the 500€ new one are out of budget

R.


> --
> Regards,
>  - Graeme -
>
>
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sql server embedded: sqlite the only solution?

2009-12-16 Thread Roberto Padovani
What about data encryption? Is anyone of those providing it ?

Thanks!

R#

2009/12/16 ik :
> You also have Firebird Embeeded and MySQL Embedded (I really dislike MySQL)
> afaik.
>
> Ido
>
> http://ik.homelinux.org/
>
>
> On Wed, Dec 16, 2009 at 4:53 PM, Codebue Fabio - P-Soft
>  wrote:
>>
>> I'm trying to develop an application on windows mobile with lazarus/free
>> pascal.
>> I need SQL server embedded on it to manage a lot of data.
>>
>> SQLite3 is the only solution available?
>>
>> I CAN'T find information anywhere... some idea?
>>
>>
>>
>> Codebue Fabio
>>
>> ___
>> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access to RS232 ports with fpc

2009-11-02 Thread Roberto Padovani
There's nothing limited within the compiler! If you have the same
knowledge and expertise of Pascal and C,  IMHO with gcc you will only
be complicating your life.

About serial port, low level routine need some practice, but you can
go quickly to the point with this component for lazarus:

http://sourceforge.net/projects/cportlaz/

You get threaded data reception and even packet parsing with automatic
event fire on a specific packet pattern.
I am using it to develop hardware monitors which are running smoothly
also on old fashioned hardware, so there's no packet loss or packet
corruption.

R#


2009/11/2 Holger Bruns :
> Martin schrieb:
>>
>> Holger Bruns wrote:
>>>
>>> Jürgen Hestermann schrieb:
>
> function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt):
> LongInt;
>   begin
>   Result := fpRead(Handle, Buffer, Count);
>   end;
> i don't understand the declaration for "buffer" in the function below,
> because no type is declared for "buffer".

 I believe that the type is irrelevant, you can use whatever you want. I
 think that it's just used by fpRead to buffer data. You only provide the
 space for the buffer but you don't need to read it directly. It seems that
 Count has to be the size of the buffer. But I am just guessing
>>>
>>> My hope was to read more than guessing. As I pointed out, the "buffer"
>>> seems not to be filled with incoming data from the selected serial port.
>>> Hence I cannot read just this data, and serread seems to be faulty. For this
>>> reason I ask for an advice. I need to look on working sample code to use
>>> this function in a working manner. In my example, serread replies only, what
>>> has been written with serwrite right before. Not even serflush, executed
>>> right after serwrite, can solve this problem to me.
>>
>> var foo;
>> const foo;
>>
>> are hidden pointer types.
>> That is foo would contain a pointer, but you never see this. You never
>> have to get the address of something, and you never have to dereference it.
>>
>> As for using this:
>>
>> SerRead(Handle, Buffer, 0)
>>
>> Buffer must be the first byte of a block of memory
>>
>> you can do:
>> var buffer: Array of byte;
>>
>> SetLength(Buffer, 1000);
>> SerRead(Handle, Buffer[0], 1000);
>>
>
> Hi Martin,
>
> I checked this out. It works not reliable. Sometimes I get real data,
> sometimes the data are corrupted. I have no idea to rule out corrupted data.
> I also tried to use the synaser unit, which can be found on the internet.
> The demo code "sertest" crashes instantly.
>
> The only way to get rid of this problem is a direct port access. But direct
> port access is only possible for the first 200 port addresses. A "port"
> array is not yet implemented, and the required higher port addresses are
> strictly ruled out from every use through compiled fpc programs. I do not
> understand this harsh policy. And I have no idea to rule this policy out. If
> there is any possibility to get access to all ports on the system without
> access error messages, please let me know. If I need to alter the compiler,
> is there a patch available? Or should I use gcc rather than fpc to match my
> ideas?
>
> The real sad thing is, that one cannot produce software for Linux, based on
> the restricted free pascal compiler. I am really disappointed.
>
> Best regards, Holger
>
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] The reason why linus torvalds hate-pascal

2008-04-15 Thread Roberto Padovani
Ahthe old goto arguinghow many beers have gone with it!
Linus is just right, since everyday the purists of the OO languages
still can't live without writing a GOTO; they just call it in another
"politically correct" way:

raise Exception.Create("TA-DA!")

R#


2008/4/15, Joost van der Sluis <[EMAIL PROTECTED]>:
> Op dinsdag 15-04-2008 om 10:18 uur [tijdzone +0300], schreef ik:
>
> > Hi,
>  >
>  > I have read in the Linux Kernel malling list some emails, and I found
>  > some points made by Linus Torvalds about Pasca;
>  >
>  > 
> http://idkn.wordpress.com/2008/04/15/the-reason-why-linus-torvalds-hate-pascal/
>  >
>
>
> Your statement in the blog-posting is not entirely true. What Linus does
>  in this thread is arguing why goto's could be meaningfull sometimes.
>  Apparently he thinks that the idea that goto's are evil in all cases
>  comes from Nikolaus Wirth. To prove that he (Wirth) was wrong, he points
>  at some weaknesses of the language that Wirth had developed. And that
>  was indeed this old pascal version. This language didn't had any goto's
>  but that didn't make it more readable. It would even be more readable if
>  it had support for goto. (That's Linus statement)
>
>  Linus also put (traditional) before pascal, just to make this clear. So
>  I don't see this as a 'rant on pascal', but just arguing with some
>  examples of older languages that goto's could be good in some cases.
>
>
>  Joost.
>
>
>
>
>  ___
>  fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>  http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MaskEdit

2008-01-28 Thread Roberto Padovani
a TMaskEdit was posted in attachment by David on 23-nov-2007
The subject wasRe: [lazarus] TMaskEdit new release

R#

2008/1/27, Felipe Monteiro de Carvalho <[EMAIL PROTECTED]>:
> On Jan 27, 2008 5:40 PM, Marek Nožka <[EMAIL PROTECTED]> wrote:
> > But how is it possible, that the compilation is done?
>
> It isn't that there is nothing from TMaskEdit on LCL. There is very
> little, enougth to compile and maybe to do some things, but it isn't
> complete.
>
> I think someone commited a partial implementation recently, so I would
> recommend that you try using subversion Lazarus and see if it works
> there for you. Search for instructions on the wiki.
>
> --
> Felipe Monteiro de Carvalho
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Notice: Possible copyright infringements in FPC code base

2008-01-16 Thread Roberto Padovani
Thanks a lot!
you can't find a lawyer anywhere when you need it! :-) I'm joking, of course...

Given that I don't have Delphi, suppose that company X ask me to make
a software for them. I might give them the software, with full source
code and a GPL licence note every here and there, and ask money for
the _design_ of the software, instead of the software itself.
How does it sound to you and eventual hidden lawyer "listening" to us ?

thanks for your job, really!
If I were even a little bit good at programming (serious programming
and not just having a computer do what I need), I would be the perfect
clean room programmernever had any sort of delphi and never read
any source at all !

cheers,

 Roberto


2008/1/16, Michael Van Canneyt <[EMAIL PROTECTED]>:
>
>
> On Wed, 16 Jan 2008, Roberto Padovani wrote:
>
> > I've been following this topic from the beginning and I took the time
> > to read the (questionable) blog from the ex-CG developer.
> >
> > I'm interested in it because aside my personal enjoyment, I started
> > using freepascal+lazarus where I work in order to quickly solve some
> > needs like data analysis, algorithms benchmarking before
> > implementation, controlling our hardware from the pc, and so
> > on...related to the hardware we design (I'm a hardware engineer).
> >
> > Well, what kind of implication should I expect if, for any reason,
> > things turn to bad?
> > Those implication suggested by the blogger are so serious that if I
> > were trusting him, I would immediately erase all disks with my pascal
> > stuff and buy new ones.
>
> Not too much implication, for you, normally:
>
> 1. If you have a licensed copy of Delphi, you can ignore it:
>you are allowed to use this source code.
>
>(We do not have the right to distribute it, but that is our problem,
> which we must solve, and which we are solving)
>
> 2. If you don't have a licensed copy, you can still use the GPLed version of
>CLX which is freely downloadable from Sourceforge: it is the same code as
>the Delphi code. It does mean that your application needs to be GPLed.
>If you don't distribute them, this is not a problem at all...
>
> So the only case when you could have problems is when both the following
> conditions are true:
> a) you don't have a registered Delphi
> b) you use FPC/Lazarus to create and distribute closed-source commercial 
> software.
>
> In this case, then the remedy is to wait for the next release which has
> the clean-room code, and simply recompile your application.
> It is also under the assumption that Codegear actually can prove that we
> have been infringing on copyright.
>
> Things get more complicated even because Codegear is US based, and most FPC
> development happens in Europe and south america: I don't know whether a US
> copyright is enforceable here in europe.
>
> Note that this is my understanding of things, and in no way binding legal
> advice, I am not a lawyer after all... :-)
>
> Michael.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Notice: Possible copyright infringements in FPC code base

2008-01-16 Thread Roberto Padovani
I've been following this topic from the beginning and I took the time
to read the (questionable) blog from the ex-CG developer.

I'm interested in it because aside my personal enjoyment, I started
using freepascal+lazarus where I work in order to quickly solve some
needs like data analysis, algorithms benchmarking before
implementation, controlling our hardware from the pc, and so
on...related to the hardware we design (I'm a hardware engineer).

Well, what kind of implication should I expect if, for any reason,
things turn to bad?
Those implication suggested by the blogger are so serious that if I
were trusting him, I would immediately erase all disks with my pascal
stuff and buy new ones.

R#


2008/1/16, Graeme Geldenhuys <[EMAIL PROTECTED]>:
> On 16/01/2008, Tiziano De Togni <[EMAIL PROTECTED]> wrote:
> >
> > Could you please tell me if there is a real chance that CodeGear asks
> > money for a concrete copyright violation to someone of the FPC or
> > Lazarus developers?
>
> FPC developers approached them (CodeGear) and took it on ourselves to
> solve the issue. We found a automated tool to help, listed the suspect
> code and fixed it by rewriting the suspect code. CodeGear has nothing
> to complain about as far as I can see!  FPC developers did not wait to
> be reprimanded - they fixed it as soon as they found out about it.
>
> Regards,
>   - Graeme -
>
>
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] copy(), length(), and setlength() is not mentioned in fpc docs?

2007-12-05 Thread Roberto Padovani
BTW, I like your chm documentation...it's actually much quicker to
search than pdf (acroreader is slow for me with 1500 pages). And it
also searches for "related topics"...very good job IMHO.

R#


2007/12/5, Bee <[EMAIL PROTECTED]>:
> > This is documentation generated with fpc 2.3.1 source code.
>
> Ah, there must be something wrong with fpc 2.2.0 generated documentation. :(
>
> BTW... where can I download laz 9.24 documentation? I'd like to convert
> them to chm format as well. Just like what I did to fpc doc 2.2.0. :)
>
> -Bee-
>
> has Bee.ography at:
> http://beeography.wordpress.com
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] can we have fpc's doc in chm format?

2007-12-04 Thread Roberto Padovani
why not giving it a try ? :-) I'm downloading

2007/12/4, Bee <[EMAIL PROTECTED]>:
> > Agree. However, I was finally able to finish this job last night. It
> > took me about 6 hours to re-arrange the index files, manually. For
> > everyone who is interested, fpc docs in chm format can be downloaded at:
> > http://www.esnips.com/doc/04496e39-6105-423d-b571-b0766990b060/fpc-2.2.0-docs
> > (5.8 MB compressed)
>
> Can we provide this file on fpc's doc ftp?
>
> -Bee-
>
> has Bee.ography at:
> http://beeography.wordpress.com
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


-- 
--
 Ing. Roberto Padovani

 via Mandrioli, 1
 40061 Minerbio (BO)
 Italy

 mail: [EMAIL PROTECTED]
 cell: 340-3428685
-
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal