Turan Can
-
Content Count
63 -
Joined
-
Last visited
Posts posted by Turan Can
-
-
This has to be. Because remote desktop connection products will not work otherwise.
It has to be active with an authorization. -
Mouse, Detection of mouse click
I need a sample code to post mosu as x, y.
Important: I want to click outside the form globally, not on the form.So even if the form is running in the background, I want to click on a point I want.
function MousePos: TPointF;
var
MouseService: IFMXMouseService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXMouseService, IInterface(MouseService)) then
Exit(MouseService.GetMousePos);
Result := PointF(0, 0);
end; -
First of all thanks for the reply.
This only works in the open form.
I want to activate the mouse anywhere on the phone. -
Hi All,
Does anyone know the equivalent of these 2 features in android?
I want to click on the X, Y coordinates I sent.
Windows vcl;
I've been using these on windows with no problems.
SetCursorPos
Mouse_Event
Android ??
event: JMotionEvent;
Form1.MouseMove([], Mouse.Left, Mouse.Top); -
After great effort I solved the problem. Thanks everyone for the unanswered message 😉
-
I realized that no one is developing with video or audio features in Delphi android.
Display, sound, keyboard, socket etc. features are priority concepts.
I converted it from java to delphi with great effort, but I couldn't even find an answer to it. It's a very sad scene. -
MediaProjection service type not recognized in android Q - Stack Overflow
Is there a "startForeground()" delphide example of this method?
TJService.Create.startForeground(); // FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
I couldn't find it, under which service?
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
-
You have to design it yourself,
On click form properties...
BorderStyle : bsNone
OnPaint
procedure TForm1.FormPaint(Sender: TObject);
begin
OnBasePaint(ClientWidth, ClientHeight, Canvas);
end;procedure TfmMain1.OnBasePaint(ClientWidth, ClientHeight: Integer; Canvas: TCanvas);
var
Rect: TRect;
begin
Rect.Left := 0;
Rect.Top := 0;
Rect.Bottom := ClientHeight;
Rect.Right := ClientWidth;
with Canvas do
begin
// Pen.Width := 2;
// Brush.Color := $00000000;
// Pen.Color := $006B6B6B;
// Rectangle(0, 0, ClientWidth, ClientHeight);
end;
end; -
Add dropdown menu and when clicked. Activate a hidden treeview menu.
For example, I'm using a panel instead of a button because there is no color in the buttons 🙂
-
Hi All,
I was capturing android screenshot but it doesn't work on newer versions.
Return error code;
Project AndroidTest.apk raised exception class EJNIException with message 'java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION'.Permission add on: Foreground Service
I gave the "AndroidManifest" in authorization.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Another weird problem is the service I added "AndroidManifest".
TJManifest_permission.JavaClass... is not in "FOREGROUND_SERVICE" the service, INSTANT_APP_FOREGROUND_SERVICE
Attached is a sample project.
Delphi 11 build project
function TForm1.OnActivity(RequestCode, ResultCode: integer; Itt: JIntent): Boolean;
var
MPro: JMediaProjection;
begin
Result := false;
if RequestCode = REQUEST_CODE_SCREEN_CAPTURE then
begin
if ResultCode = TJActivity.JavaClass.RESULT_OK then
begin///Return error code;
///Project AndroidTest.apk raised exception class EJNIException with message 'java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION'.
MPro := FMedia.getMediaProjection(ResultCode, Itt);
if MPro <> nil then
begin
// ...
Result := true;
ShowMessage('Ok')
end;
end;
end;
end; -
I solved the problem thanks
-
Hi All,
When I want to download a page on the website, it downloads a maximum of 4095 bytes. How can I remove this limit?
function TDownloadFile.WebGetData(const UserAgent: string; const Url: string): string;
var
hInet: HINTERNET;
hURL: HINTERNET;
Buffer: array [0 .. 10] of AnsiChar;
BufferLen: Cardinal;
dwTimeOut: DWORD;
begin
Result := '';hInet := InternetOpen(PChar(UserAgent), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if hInet = nil then
RaiseLastOSError;
try
// dwTimeOut := 2000; // Timeout in milliseconds
// InternetSetOption(hInet, INTERNET_OPTION_CONNECT_TIMEOUT, @dwTimeOut, SizeOf(dwTimeOut));hURL := InternetOpenUrl(hInet, PChar(Url), nil, 0, INTERNET_FLAG_PRAGMA_NOCACHE or INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_RELOAD, 0);
if hURL = nil then
RaiseLastOSError;
try
repeat
if not InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) then
RaiseLastOSError;
Result := Result + UTF8Decode(Copy(Buffer, 1, BufferLen))
until BufferLen = 0;
finally
InternetCloseHandle(hURL);
end;
finally
InternetCloseHandle(hInet);
end;
end; -
Hi All,
The foreground program works fine.
However, when I open another program, it becomes disabled after a short while.
What do we need to do to keep the background work going?I tried a thing or two but it didn't work.
This feature exists but I couldn't find Delphide ..?
"Use <android.permission.FOREGROUND_SERVICE permission: name ="
"Uses Permissions - RAD Studio (embarcadero.com)
-
The problem is solved. I convert from the Java example.
Thanks. It only receives the form you send. Please check the picture above.- 1
-
Remy,
Thanks for the explanatory information.
-
Hi All,
FMX Project.
"TBitmapCodecManager" doesn't support bitmap on Android?
These are the only ones that come when I enter this "TBitmapCodecManager.SaveToStream(" method.
POSIX
jpg, tif, png
WINDOWS
jpg, tif, png, bmp ...
for Descriptor in FBitmapCodecClassDescriptors do
if (SameText(Extension, Descriptor.Extension, loUserLocale) or SameText('.' + Extension, Descriptor.Extension, loUserLocale)) and Descriptor.CanSave then
--------------------------------------------------------------------
uses FMX.Graphics, FMX.Surfaces;
var
Stream: TMemoryStream;
Surf: TBitmapSurface;begin
Stream := TMemoryStream.Create;
try
Surf := TBitmapSurface.Create;
try
Surf.Assign(FBmpNew);
//TBitmapCodecManager.RegisterBitmapCodecClass('.bmp', 'bmp', True, ......???
TBitmapCodecManager.SaveToStream(Stream, Surf, '.bmp');
finally
Surf.Free;
end;
Stream.Position := 0;
Stream.SaveToStream(FStream);
finally
Stream.Free;
end; -
Limelect,
There is no code language issue for me. I am reviewing what you sent.
Thanks a lot for the information.
There are several api used in the code you sent, I'll review them.
- 1
-
Hi limelect,
As I share in the picture, can it get the top bar and bottom bar showing clock and battery?
-
In the Java example, it did not capture the entire screen, but took a screenshot of the form it was attached to.
so it is no different from the sample code I made.I think I need to take a screenshot with a handle from a plugin or api. but I could not find any examples android.
Delphi, Java, C# xamarin
I could not find an example of a full screenshot for android in these 3 languages.
1- Java sample
-
Hello everyone,
Full screenshot.
How do I capture the entire screen?
In this example, I can take a screenshot of the open form.
Sample;
function MakeScaleScreenshot(Sender: TObject): TBitmap;
var
fScreenScale: Single;
function GetScreenScale: Single;
var
ScreenService: IFMXScreenService;
begin
Result := 1;
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then
begin
Result := ScreenService.GetScreenScale;
end;
end;begin
fScreenScale := GetScreenScale;
Result := TBitmap.Create(Round(TfmText1(Sender).Width * fScreenScale), Round(TfmText1(Sender).Height * fScreenScale));
Result.Clear(0);
if Result.Canvas.BeginScene then
try
TfmText1(Sender).PaintTo(Result.Canvas);
// Sender.PaintTo( Result.Canvas); //, RectF(0, 0, Result.Width, Result.Height));
finally
Result.Canvas.EndScene;
end;
end;procedure TfmText1.btnScreenClick(Sender: TObject);
var
B: TBitmap;
beginB := MakeScaleScreenshot(Self);
// MakeScreenshot(Image1);
Image1.Bitmap.Assign(B);
B.DisposeOf;
end; -
Lars,
Thanks for information
I will investigate a little more. Because I only have problems with renewal refresh explorer icon cache. I hope I will find a method 🙂
https://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app
ms-settings:taskbar
"explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}"
Shell execute list
-
Hallo David,
Ik heb een simpel probleem.
This method you sent has worked.
https://stackoverflow.com/questions/7877435/set-tray-icon-to-always-show
I added the software to the trayicon section without the need for Windows settings.
I have to do this for the icon to appear. Turn "Explorer.exe" on / off.
Opening and closing the "Explorer.exe" file bothers the user.
How can I renew "Explorer.exe" without closing / opening it? -
Hi All,
What to do to reload the tray icon?
I haven't tried 3 different methods, is there any different idea?
The icon is inactive because my application started late.
If I do this, the problem will be fixed. However, this is frustrating at every opening.
taskkill /f /im explorer.exe
start explorer.exeThe methods I tried.
ie4uinit.exe -ClearIconCache
ie4uinit.exe -show
CD /d %userprofile%\AppData\Local
DEL IconCache.db /a
EXIT
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shchangenotify
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0, SMTO_ABORTIFHUNG, 100000, nil);
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
https://superuser.com/questions/499078/refresh-icon-cache-without-rebooting
https://github.com/crazy-max/IconsRefresh
-
Foreground service
in FMX
Posted
This example will help you. Take a look at this.
https://stackoverflow.com/questions/60466609/start-foreground-service-in-delphi-10-3