Non-Latin (non-English) identifiers for COM automation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Non-Latin (non-English) identifiers for COM automation

Max Vlasov
Hi,

is it possible for fpc to allow using non-english characters for symbols when COM-automation is used?
An accountant-related application very popular here in Russia mostly uses Cyrillic symbols for naming methods and properties of their OLE Object. They probably have English counterparts, but they're very hard to find since not so many uses this software outside of Russia.

Delphi starting some version seems to support non-latin identifiers, at least I saw examples at the web. But I currently doesn't have access to latest versions.

Or is there any other way to access some ole identifier other than direct referencing so instead of
...
  OleVariant.SomeMethodMaybeNonLatin...
...
  OleVariant.IntermediateAccess('SomeMethodMaybeNonLatin') ....


Thanks,

Max Vlasov

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Non-Latin (non-English) identifiers for COM automation

Sven Barth-2
On 21.06.2013 09:01, Max Vlasov wrote:

> Hi,
>
> is it possible for fpc to allow using non-english characters for symbols
> when COM-automation is used?
> An accountant-related application very popular here in Russia mostly
> uses Cyrillic symbols for naming methods and properties of their OLE
> Object. They probably have English counterparts, but they're very hard
> to find since not so many uses this software outside of Russia.
>
> Delphi starting some version seems to support non-latin identifiers, at
> least I saw examples at the web. But I currently doesn't have access to
> latest versions.
>
> Or is there any other way to access some ole identifier other than
> direct referencing so instead of
> ...
>    OleVariant.SomeMethodMaybeNonLatin...
> ...
>    OleVariant.IntermediateAccess('SomeMethodMaybeNonLatin') ....

It *should* work by casting your OleVariant to a IDispatch (e.g.
IDispatch(MyOleVariant) ) and then calling GetIDsOfNames and Invoke. For
more information please take a look at the MSDN documentation of
IDispatch here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms221608%28v=vs.85%29.aspx
You might also try to find examples for Delphi where GetIDsOfNames and
Invoke are used directly as I've never done this before...

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Non-Latin (non-English) identifiers for COM automation

Max Vlasov
Sven, thanks,

I did something like this. Luckily both Delphi and fpc have a function variable VarDispProc doing all the job. So my function calling a name without parameters look very simple

....

type
  TVarDispInvoke = procedure(Result: PVariant; const Instance: Variant;
    CallDesc: PCallDesc; Params: Pointer); cdecl;

function DCNA(Instance: Variant; const Name: string): Variant;
var
  CallDesc: TCallDesc;
begin
  CallDesc.CallType:=DISPATCH_METHOD;
  CallDesc.ArgCount:=0;
  CallDesc.NamedArgCount:=0;
  StrPCopy(@CallDesc.ArgTypes[0], Name);
  TVarDispInvoke(VarDispProc)(@Result, Instance, @CallDesc, Nil);
end;

.....

So for an OleVariant instance V the calls
  V.SomeMethod
and
  DCNA(V, 'Somemethod')

are equivalent. Only that the latter can accept Cyrillic methods now

Max


On Sat, Jun 22, 2013 at 12:40 AM, Sven Barth <[hidden email]> wrote:
On 21.06.2013 09:01, Max Vlasov wrote:
Hi,

is it possible for fpc to allow using non-english characters for symbols
when COM-automation is used?
An accountant-related application very popular here in Russia mostly
uses Cyrillic symbols for naming methods and properties of their OLE
Object. They probably have English counterparts, but they're very hard
to find since not so many uses this software outside of Russia.

Delphi starting some version seems to support non-latin identifiers, at
least I saw examples at the web. But I currently doesn't have access to
latest versions.

Or is there any other way to access some ole identifier other than
direct referencing so instead of
...
   OleVariant.SomeMethodMaybeNonLatin...
...
   OleVariant.IntermediateAccess('SomeMethodMaybeNonLatin') ....

It *should* work by casting your OleVariant to a IDispatch (e.g. IDispatch(MyOleVariant) ) and then calling GetIDsOfNames and Invoke. For more information please take a look at the MSDN documentation of IDispatch here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms221608%28v=vs.85%29.aspx
You might also try to find examples for Delphi where GetIDsOfNames and Invoke are used directly as I've never done this before...

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal