AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Geolocation Windows API

Ein Thema von dtpfl · begonnen am 18. Aug 2022 · letzter Beitrag vom 26. Aug 2022
Antwort Antwort
Seite 1 von 2  1 2   
Mantrid

Registriert seit: 6. Jun 2022
Ort: Deutschland
31 Beiträge
 
#1

AW: Geolocation Windows API

  Alt 24. Aug 2022, 07:03
Ich melde mich mal die Tage.
Muss nicht sein.

Im Moment interessieren uns nur ERP Programme, die wir bei unseren Kunden verwenden könnten. Für alles andere wird derzeit kein Auftrag angenommen.
  Mit Zitat antworten Zitat
TiGü

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

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
Benutzerbild von dtpfl
dtpfl

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

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
TurboMagic

Registriert seit: 28. Feb 2016
Ort: Nordost Baden-Württemberg
3.045 Beiträge
 
Delphi 12 Athens
 
#4

AW: Geolocation Windows API

  Alt 24. Aug 2022, 20:19
Debug DCUs: Projekt/Optionen/Erzeugen/Delphi-Compiler/Compilieren/Mit Debug DCUs
  Mit Zitat antworten Zitat
Benutzerbild von dtpfl
dtpfl

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

AW: Geolocation Windows API

  Alt 25. Aug 2022, 15:00
Zitat:
IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113)) gefragt, was als bekannte Hex(-String)
Wie kommst du von diesem Wert zu diesem Hex(-String)? Was wäre hier die einfachste Möglichkeit?
Delphi-Community Discord:
https://discord.com/invite/c382VBk
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.691 Beiträge
 
Delphi 11 Alexandria
 
#6

AW: Geolocation Windows API

  Alt 25. Aug 2022, 15:51
Zitat:
IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113)) gefragt, was als bekannte Hex(-String)
Wie kommst du von diesem Wert zu diesem Hex(-String)? Was wäre hier die einfachste Möglichkeit?
Vielleicht so?
Delphi-Quellcode:
  function ToIID(A: Cardinal; B, C: Word; D, E, F, G, H, I, J, K: Byte): string;
  begin
    Result := '{' + IntToHex(A) + '-' + IntToHex(B) + '-' + IntToHex(C) + '-' +
              IntToHex(D) + IntToHex(E) + '-' + IntToHex(F) + IntToHex(G) +
              IntToHex(H) + IntToHex(I) + IntToHex(J) + IntToHex(K) + '}';
  end;
var
  s: string;
begin
  s := ToIID(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113);
  ShowMessage(s);
end;
Gruß vom KodeZwerg

Geändert von KodeZwerg (25. Aug 2022 um 16:01 Uhr)
  Mit Zitat antworten Zitat
TiGü

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

AW: Geolocation Windows API

  Alt 26. Aug 2022, 10:57
Zitat:
IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113)) gefragt, was als bekannte Hex(-String)
Wie kommst du von diesem Wert zu diesem Hex(-String)? Was wäre hier die einfachste Möglichkeit?
Kopfrechnen?

Nur Spaß, mit ein-zwei Zeilen bist du dabei (siehe auch vorige Antworten):

Delphi-Quellcode:
program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

var
    IID: TGUID;

begin
  try
    IID := TGUID.Create(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113);
    Writeln(IID.ToString)
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  Readln;
end.

Das verwendet dann den TGUIDHelper aus System.SysUtils (nein, ich weiß nicht seit wann das drin ist, bitte fragt nicht):
Delphi-Quellcode:
class function TGUIDHelper.Create(A: Cardinal; B, C: Word; D, E, F, G, H, I, J, K: Byte): TGUID;
begin
  Result.D1 := UInt32(A);
  Result.D2 := Word(B);
  Result.D3 := Word(C);
  Result.D4[0] := D;
  Result.D4[1] := E;
  Result.D4[2] := F;
  Result.D4[3] := G;
  Result.D4[4] := H;
  Result.D4[5] := I;
  Result.D4[6] := J;
  Result.D4[7] := K;
end;
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.372 Beiträge
 
Delphi 12 Athens
 
#8

AW: Geolocation Windows API

  Alt 26. Aug 2022, 12:01
Delphi-Quellcode:
procedure guidtest(guid: TGUID);
begin
end;

const
  myguid: TGUID = '{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'; // hier geht es, unten nicht :(

procedure TForm21.FormCreate(Sender: TObject);
var
  guid: TGUID;
  bytes: TBytes;
begin
  guid := TGUID.Create('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}');
  //guid := '{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}';
  guid := myguid; // komisch da geht es, warum nicht auch das davor?
  //guidtest('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'); geht auch nicht
  guidtest(TGUID.Create('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'));

  // den hatte ich auf die Schnelle übersehn .. dachte ihn gibt es (noch) nicht
  guid := TGUID.Create(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113);

  // mit der ByteOrder bin ich mir grade nicht sicher ... kann sein (wird aber bestimmt so sein), das man die ersten LongWord/Word umdrehen muß.
  bytes := [243, 82, 76, 147, {} 229, 199, {} 91, 136, {} 190, 219, 211, 230, 55, 207, 242, 113];
  guid := TGUID.Create(bytes); // als Array
  guid := TGUID.Create(bytes[0]); // als "irgendwelche" binäre Daten (Zeiger) -> TGUIDHelper.Create(const Data; DataEndian: TEndian=TEndian.Little)
end;
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.372 Beiträge
 
Delphi 12 Athens
 
#9

AW: Geolocation Windows API

  Alt 25. Aug 2022, 17:12
ID.ToString Delphi-Referenz durchsuchenTGuidHelper.ToString


aber das denke ich liegt daran dass VCL keine WINUI oder UWP ist.
Das kann man so nicht mehr so einfach sagen.

Ich weiß jetzt nicht, wie es bei dieser Komponente aussieht, aber viele neue Komponenten, im Delphi, greifen intern auf die API der UWP zu, auch wenn du für Win32 (32 oder 64 Bit) kompiliert hast.
Wenn ich mich recht erinnere, z.B. bei den Bluetooth-Komponenten.

Btw. wo enable ich Debug-DCU?
Projekt-Optionen > Delphi-Compiler -> Compilieren
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.691 Beiträge
 
Delphi 11 Alexandria
 
#10

AW: Geolocation Windows API

  Alt 25. Aug 2022, 23:22
Wie wendet man das an um aus "IID = (4082257043, 58823, 23432, (190, 219, 211, 230, 55, 207, 242, 113))" das zu machen "{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}" ?
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2   

 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:03 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-2025 by Thomas Breitkreuz