Thema: Delphi Geolocation Windows API

Einzelnen Beitrag anzeigen

Benutzerbild von dtpfl
dtpfl

Registriert seit: 19. Jan 2018
Ort: Bayern
20 Beiträge
 
Delphi 12 Athens
 
#8

AW: Geolocation Windows API

  Alt 24. Aug 2022, 20:11
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.
Oh wow vielen Dank! So tief war ich noch nie im Debuggen.
Ich krieg zwar keinen Dialog wo man nach der Erlaubnis gefragt wird, aber das denke ich liegt daran dass VCL keine WINUI oder UWP ist.
Ich schau mal was ich hier machen kann.

Btw. wo enable ich Debug-DCU?
Delphi-Community Discord:
https://discord.com/invite/c382VBk
  Mit Zitat antworten Zitat