[fpc-pascal] Non-Latin (non-English) identifiers for COM automation

Max Vlasov max.vlasov at gmail.com
Sat Jun 22 09:40:40 CEST 2013


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 <pascaldragon at googlemail.com>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<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  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130622/017265f8/attachment.html>


More information about the fpc-pascal mailing list