-
Content Count
35 -
Joined
-
Last visited
Everything posted by davornik
-
Is it posible in Android to intercept keyboard presses from hardware keyboard attached to device? I can detect is HID Device present, but how to get key input from HID before form does? function TForm1.AttachedHIDDevice: Boolean; var i: Jiterator; JavaObject: JObject; DeviceList: JHashMap; USBDevice: JUSBDevice; UsbManager: JUSBManager; begin //Device discovery Result := False; //Get pointer to UsbManager JavaObject := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.USB_SERVICE); UsbManager := TJUsbManager.Wrap((JavaObject as ILocalObject).GetObjectID); if not Assigned(UsbManager) then Exit; //Get a list of connected devices DeviceList := UsbManager.getDeviceList; i := DeviceList.values.iterator; while i.hasNext do begin USBDevice := TJUsbDevice.Wrap((i.next as ILocalObject).GetObjectID); if (USBDevice.getInterfaceCount > 0) then begin Result := USBDevice.getInterface(0).getInterfaceClass = TJUsbConstantsUSB_CLASS_HID; if Result then Break; end; end; end;
-
Yes, I want to determine from where key is sent.
-
I would like to intercept Key from external keyboard before it reaches TEdit or Form. Is this possible?
-
That is not good solution, has some issues. However, OnFormKeyUp is better choice (key is possible to receive only once according to Android docs), but if TEdit is focused TForm doesn't get key. Then, again, if I type Key in external keyboard and I am in TEdit control, key is shown in TEdit (I would like to Intercept it before it reaches any Control on Form or Form itself). Is it possible to differentiate Key origin? Is it received from Virtual Keyboard or HID device?
-
Sdk version in AndroidManifest file and Rad Studio
davornik replied to Alex Texera's topic in Delphi IDE and APIs
Perhaps you can use this thread: https://en.delphipraxis.net/topic/5883-delphi-1042-ce-support-android-api-30/ -
Thank you for yours post, this also helped me to upload app to Google store. Just to make things clearer to download android-30 you must: - run cmd.exe - type cd [path] to go to location where sdkmanager.bat is (usually it is: C:\Users\Public\Documents\Embarcadero\Studio\21.0\PlatformSDKs\android-sdk-windows\tools\bin or C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\tools\bin) - type sdkmanager "platforms;android-30" - answer y on question, and wait until it says "done" Everything else is straightforward...
-
Code can be made compatible with 64-bit, i have posted probable solution here: https://stackoverflow.com/a/61874765/3225668 NOTE: in FastcodeCPUID.pas there is an error with position of registers when returning value. Registers in code goes like Move...EBX...EDX...ECX... Proper way should be EBX...ECX...EDX...!
-
// VMware detection as described by Elias Bachaalany function IsInsideVMware: Boolean; //------------------------------ procedure ChkVMware; asm push edx; push ecx; push ebx; mov eax, 'VMXh'; mov ebx, 0; mov ecx, 10; mov edx, 'VX'; in eax, dx; cmp ebx, 'VMXh'; setz [Result]; pop ebx; pop ecx; pop edx; end; //------------------------------ begin Result := True; try ChkVMware; except Result := False; end; end; function IsRunningUnderHyperV: BOOL; stdcall; var VMBranding: array[0..12] of AnsiChar; //------------------------------ procedure GetVMBrand; asm mov eax, $40000000; cpuid; mov dword ptr [VMBranding+0], ebx; // Get the VM branding string mov dword ptr [VMBranding+4], ecx; mov dword ptr [VMBranding+8], edx; end; //------------------------------ begin GetVMBrand; VMBranding[12] := #0; Result := CompareText(String(VMBranding), 'Microsoft Hv') = 0; end; How can thiese function be done in 64-bit? On compile I get [dcc64 Error] Unit1.pas(33): E2116 Invalid combination of opcode and operands Registers need to be changed. Which to use?
-
I have finally found solution and posted it here: https://stackoverflow.com/a/61874765/3225668
-
procedure ChkVMware; asm push rdx; push rcx; push rbx; mov rax, 'VMXh'; mov rbx, 0; mov rcx, 10; mov rdx, 'VX'; in rax, dx; <-- here is error: operand size mismatch cmp rbx, 'VMXh'; setz [Result]; pop rbx; pop rcx; pop rdx; end; Thank you. In that link registers are like eax, edx, ecx and rbx for 32-bit, but if you change them to 64-bit (rax, rdx, rcx, rbx) then I get error: operand size mismatch. I even dont know if this is proper way to change registers?