Thema: Delphi Geolocation Windows API

Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.060 Beiträge
 
Delphi 10.4 Sydney
 
#7

AW: Geolocation Windows API

  Alt 24. Aug 2022, 07:54
Bitte sehr:
Delphi-Quellcode:
type
    TAccessStatusCompletedHandler = class(TInspectableObject,
        AsyncOperationCompletedHandler_1__GeolocationAccessStatus_Delegate_Base,
        AsyncOperationCompletedHandler_1__GeolocationAccessStatus)
    private
        FEvent: TAccessStatusCompletedHandlerCompleted;
    public
        procedure Invoke(asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus); safecall;
        constructor Create(AEvent: TAccessStatusCompletedHandlerCompleted);
    end;
Beim Debuggen der Zuweisung AsyncOperation.Completed := CompletedHandler; kommt man in TInterfacedObject.QueryInterface raus:
Code:
System.TInterfacedObject.QueryInterface((4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113)),(no value))
:76d2de72 combase.RoGetAgileReference + 0x62
:77b6272b ; C:\Windows\SysWOW64\Geolocation.dll
:77b742e1 ; C:\Windows\SysWOW64\Geolocation.dll
:77b7637d ; C:\Windows\SysWOW64\Geolocation.dll
Unit9.TForm9.Button3Click($43A6380)
Hier wird nach der IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113)) gefragt, was als bekannte Hex(-String) Darstellung dem hier entspricht: '{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}' .
Das wiederrum ist in Winapi.Devices.Geolocation das Interface AsyncOperationCompletedHandler_1__GeolocationAccessStatus_Delegate_Base .

Lessons Learned:
1. Debug-DCU einschalten.
2. Trace into (F7) Debugging nutzen.
3. Bei (COM-)Interface-Geschichten im Zweifelsfall ruhig auch das Eltern-Interface mit in die Klasse ziehen, auch wenn keine Methoden darin definiert sind.

Geändert von TiGü (24. Aug 2022 um 07:58 Uhr)
  Mit Zitat antworten Zitat