![]() |
Geolocation Windows API
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo Leute,
ich werde verrückt, ich versuche über die Windows API den Standort zu bekommen, da TLocationSensor nicht (mehr) funktioniert. ![]() Dafür will ich ![]() Ich habe ein C# Beispielprojekt kompiliert hier funktioniert es einwandfrei ( ![]()
Code:
Nun bekomme ich einen Fehler dass die Schnittstelle nicht unterstützt wird, jetzt bin ich komplett gebrochen... :lol:
var accessStatus = await Geolocator.RequestAccessAsync();
switch (accessStatus) { case GeolocationAccessStatus.Allowed: _geolocator = new Geolocator { ReportInterval = 2000 }; _geolocator.PositionChanged += OnPositionChanged; _geolocator.StatusChanged += OnStatusChanged; break; Hier ist ein Ausschnitt meines Codes (der Rest ist im Anhang)t:
Code:
Gibt es hierfür eine Lösung oder eine gute alternative zu
procedure statusCompletedAccess(asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus);
TAccessStatusCompletedHandlerCompleted = procedure(asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus) of object; type TAccessStatusCompletedHandler = class(TInspectableObject, AsyncOperationCompletedHandler_1__GeolocationAccessStatus) private FEvent: TAccessStatusCompletedHandlerCompleted; public procedure Invoke(asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus); safecall; constructor Create(AEvent: TAccessStatusCompletedHandlerCompleted); end; constructor TAccessStatusCompletedHandler.Create( AEvent: TAccessStatusCompletedHandlerCompleted); begin FEvent := AEvent; end; procedure TAccessStatusCompletedHandler.Invoke( asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus); begin FEvent(asyncInfo, asyncStatus); end; procedure TForm9.statusCompletedAccess( asyncInfo: IAsyncOperation_1__GeolocationAccessStatus; asyncStatus: AsyncStatus); begin ShowMessage('JAA!!!'); end; ![]() Falls dies aufwendiger ist und jemand das Interesse hat mir dabei zu helfen, könnte ich evtl. meinen Arbeitgeber fragen ob dieser dann auch "entschädigt" wird :D Testprojekt im Anhang. |
AW: Geolocation Windows API
Zitat:
Funktioniert dann das C# Projekt noch? Bei Microsoft Projekten ist teilweise im Manifest ein generisches Zertifikat für höhere Benutzerrechte vorhanden. Bei Einträgen wie Zitat:
Zitat:
Also mit elektronischem Kompass hat man da nur eine rudimentäre Lokalisation. Was soll damit erzielt werden? Geo Lock für Softwareverwendung? Da gibts kommerzielle Lösungen, die per DLL eingebunden werden können. Zitat:
|
AW: Geolocation Windows API
Ich würde es per HTML5 realisieren, benötigt keine kommerzielle Dll und auch nichts von Microsoft :D
|
AW: Geolocation Windows API
Geolocation ohne GPS funktioniert meist so, dass irgendwelche Anbieter W-Lan Router/AP Standorte
erfasst haben und durch die Info welche man gerade "empfängt"/"sieht" man einen ungefähren Standort ermitteln kann, wenn man genügend von denen die in der DB sind gleichzeitig sieht und eine Internetverbindung hat um diese DB abfragen zu können. Vermutlich macht das Geolocation API genau sowas im Hintergrund, wenn kein GPS vorhanden ist. Und nein, da sollte man kein HTML5 dafür brauchen. Dann wäre man ja wieder vom Browser und dessen Umsetzung abhängig, was auch nicht besser wäre. |
AW: Geolocation Windows API
Danke für die umfangreichen & hilfreichen Antworten!
Da habe ich mich evtl. falsch ausgedrückt, natürlich sollte hauptsächlich der GPS-Sensor benutzt werden, wünschenswert wäre falls GPS mal nicht verfügbar ist sollte der Standort aus z.B. WLAN oder IP herkommen, wie die ![]() Zitat:
|
AW: Geolocation Windows API
Zitat:
Im Moment interessieren uns nur ERP Programme, die wir bei unseren Kunden verwenden könnten. Für alles andere wird derzeit kein Auftrag angenommen. |
AW: Geolocation Windows API
Bitte sehr:
Delphi-Quellcode:
Beim Debuggen der Zuweisung
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;
Delphi-Quellcode:
kommt man in
AsyncOperation.Completed := CompletedHandler;
Delphi-Quellcode:
raus:
TInterfacedObject.QueryInterface
Code:
Hier wird nach der
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)
Delphi-Quellcode:
gefragt, was als bekannte Hex(-String) Darstellung dem hier entspricht:
IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113))
Delphi-Quellcode:
.
'{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'
Das wiederrum ist in Winapi.Devices.Geolocation das Interface
Delphi-Quellcode:
.
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. |
AW: Geolocation Windows API
Zitat:
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? |
AW: Geolocation Windows API
Debug DCUs: Projekt/Optionen/Erzeugen/Delphi-Compiler/Compilieren/Mit Debug DCUs
|
AW: Geolocation Windows API
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz