Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-06

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

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

Sven Barth
to Max Vlasov
Max Vlasov wrote 19 lines
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

Max Vlasov
to Sven Barth

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

Sven Barth wrote 37 lines
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<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 - http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>