Category: Firemonkey

How to index a created file in Android sdcard Delphi

In my code I create a .TXT file and store it in the shared folder "Download" like this: procedure TF_start.Button2Click(Sender: TObject); var path_file output_text: string; begin path_file := TPath.Combine(System.IOUtils.TPath.GetSharedDownloadsPath, 'Folder_app'); output_text := 'test'; if not TDirectory.Exists(path_file) then TDirectory.CreateDirectory(path_file); try TFile.WriteAllText(TPath.Combine(path_file, Nome_Arquivo), Arquivo_saida); except ShowMessage('An error occurred while saving the file.'); end; end; The file is perfectly created, but Android itself has a problem indexing the files so they can be read through Windows Explorer, so you have to rescan the folder that the file was created for so that it can be visible. There are even some apps on PlayStore that rescan the entire sdcard, but asking my client to install a secondary file to use my app is not a good choice ... I found a code that theoretically performs this rescan on a specific folder, but it doesn't work. There are no errors, but the folder and the file continue is not visible in Windows Explorer ... The code is this: procedure TF_corrida.BTNfinalize_appClick(Sender: TObject); var c: Integer; JMediaScannerCon: Androidapi.Jni.Media.JMediaScannerConnection; JMediaScannerCon_Client: Androidapi.Jni.Media.JMediaScannerConnection_MediaScannerConnectionClient; begin JMediaScannerCon:=TJMediaScannerConnection.JavaClass.init(TAndroidHelper.Context, JMediaScannerCon_Client); JMediaScannerCon.connect; c:=0; while not JMediaScannerCon.isConnected do begin Sleep(100); inc(c); if (c>20) then break; end; if (JMediaScannerCon.isConnected) then begin JMediaScannerCon.scanFile(StringToJString(path_file), nil); JMediaScannerCon.disconnect; end; end; Does anyone know why this code is not working? I even came to see that it didn't work in Delphi Tokyo, but I'm using Delphi Rio. And yes, I correctly stated the READ and WRITE storage permissions in my code. The file is created correctly, just not visible.
Read More

Installation and GetIt Workarounds for Delphi 10.3.2 (Updated)

Some of the Embarcadero servers (in one of the web farms) are experiencing some severe and prolonged outage. This is affecting (among other things) Delphi 10.3.2 installation. As a temporary workaround, the company has: provided the direct link to the ISO installer download, https://community.idera.com/developer-tools/b/blog/posts/10-3-2-installation-workarounds set up a new GetIt server to allow customers on 10.3.2 (and partially also on older 10.3.x versions) to install the most relevant add-ons and packages, like FMX Linux and Boost: https://community.idera.com/developer-tools/b/blog/posts/temporary-10-3-2-getit-server-for-installing-10-3-2-add-on-packages We should soon have the regular GetIt-based offline installer for 10.3.2 working again with the temporary server.  August 1st Update We now have the ability to install 10.3.2 via GetIt using this temporary system, there is no need to change the GetIt URL manually, as it is embedded in an updated installer. And CodeCentral MyRegistered products is online again with the updated downloads.  Read more on the latest status at https://community.idera.com/developer-tools/b/blog/posts/new-10-3-2-getit-installer. Thanks for your patience and sorry again for the inconvenience. 
Read More

This app is no longer compatible with your device

I have uploaded my first app to the Google Play Store which was compiled using the latest Rad Studio Rio Version (10.3.2). When using one of the tablets I testes the app with the Play Console app says: Your Device isn't compatible with this version The app is designed to run on tablets but will work on phones. When using Play Console (via Web) I'm told that the App isn't compatible with some of my devices, specifically the very same tablets I have been using to test the app. I've followed the guide from here. How might I move this forward? This is the app manifest as generated for me by RAD studio <!-- BEGIN_INCLUDE(manifest) -->`` <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="%package%" android:versionCode="%versionCode%" android:versionName="%versionName%" android:installLocation="%installLocation%"> <!-- This is the platform API where NativeActivity was introduced. --> <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" /> <%uses-permission%> <uses-feature android:glEsVersion="0x00020000" android:required="True"/> <application android:persistent="%persistent%" android:restoreAnyVersion="%restoreAnyVersion%" android:label="%label%" android:debuggable="%debuggable%" android:largeHeap="%largeHeap%" android:icon="%icon%" android:theme="%theme%" android:hardwareAccelerated="%hardwareAccelerated%"> <%application-meta-data%> <%services%> <!-- Our activity is a subclass of the built-in NativeActivity framework class. This will take care of integrating with our NDK code. --> <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:launchMode="singleTask"> <!-- Tell NativeActivity the name of our .so --> <meta-data android:name="android.app.lib_name" android:value="%libNameValue%" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <%activity%> <%receivers%> </application> </manifest>
Read More

KEYDOWN in Firemonkey [ CTRL and "+" ]

I need to detect the key combination CTRL and "+" sign simultaneously, sure there is a way, but I can not find the virtual code VK of the "+" sign anywhere, except the unique code of numeric keyboard vkAdd. For example, for the general sign "-", we have Vkminus and for the numeric keyboard vkSubtract. How would it be for the plus sign? if (ssCtrl in Shift) and (Key = vkminus) then // sign "-" ok ! if (ssCtrl in Shift) and (Key = ¿?) then // sign "+" :-(
Read More

iterator error/conflict on Android with push_back (FMX, C++)

I have an FMX app with a TPanel and a TScrollBox. The code below is in a TButton click event and it creates a new TChart when clicked (clones an existing chart i’m using as template). This works fine in Win32 and iOS, but fails to build for Android.

If i comment out the myCharts.push_back(C) it will build and run on Android but of course not add the new chart C to myCharts vector.

  TChart *C = new TChart(this);
  C->Parent = this->ScrollBox1;
  CloneChart(C, ChartTemplate, this, false);  // i have a template chart to copy from
  C->Align = TAlignLayout::Horizontal;
  C->Height = ChartTemplate->Height;
  C->Width = ChartTemplate->Width;
  C->Tag = myCharts.size();   
  C->HitTest = false;
  myCharts.push_back(C);
  ReSizeCharts(); // resize all charts to accommodate new one 

At the top of my Unit1.cpp i define myCharts as a global vector:

std::vector<TChart*> myCharts;

When i attempt the Android build i get the following error messages and the ide opens stl_iterator.h and highlights a row in red:

[bccaarm Error] stl_iterator.h(980): rvalue reference to type 'value_type' (aka 'Fmxtee::Chart::TChart*__strong') cannot bind to lvalue of type '__borland_class *isTObj<Fmxtee::Chart::TChart> __strong'(aka 'Fmxtee::Chart::TChart *__strong')

Here are my includes:

#include <FMXTee.Store.hpp>
#include <System.IOUtils.hpp>
#include <stdio.h>
#include <vector>
#include <memory>

I’m using 10.3.1 (Embarcadero® C++Builder 10.3 Version 26.0.33219.4899). Android SDK 25.2.5 32-bit.

Read More

Read More

Read and write a PC/SC smart card in an Android App with Delphi Rio 10.3.1 [on hold]

I'm trying to read and write the content of a PC/SC smart card using Delphi 10.3.1 without sucess on Android Apps. I found some related topics, but they make reference to NFC reading and writing and I need to do it using a Gemalto IDBridge CT-30 card reader connected through the mini-USB port. To ensure that it is possible, I have installed an ATR reader App on my cell phone and it works fine. Till now I was unable to connect, read and write the smart card data through the card reader. I found this code in some of my searches, that can be seen in this answer too: unit Androidapi.JNI.NfcAdapter; // JNI NFC import demo // Note - REQUIRES - PROJECT OPTIONS - USES PERMISSIONS - NFC interface uses Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android, SysUtils, Classes; type /////////////////////////// NfcAdapter ///////////////////////////////// JNfcManager = interface; JNfcAdapter = interface; JNfcAdapterClass = interface(JObjectClass) ['{634258AC-7931-4E38-97E6-48DBF688A288}'] {Property methods} function _ACTION_TAG_DISCOVERED: JString; cdecl; function _EXTRA_ID: JString; cdecl; function _EXTRA_NDEF_MESSAGES: JString; cdecl; function _EXTRA_TAG: JString; cdecl; {Properties} property ACTION_TAG_DISCOVERED: JString read _ACTION_TAG_DISCOVERED; property EXTRA_ID: JString read _EXTRA_ID; property EXTRA_NDEF_MESSAGES: JString read _EXTRA_NDEF_MESSAGES; property EXTRA_TAG: JString read _EXTRA_TAG; end; [JavaSignature('android/nfc/NfcAdapter')] JNfcAdapter = interface(JObject) ['{364D8F3F-23AE-4C28-A261-E30C0893B24C}'] //Return true if this NFC Adapter has any features enabled function isEnabled: Boolean; cdecl; end; TJNfcAdapter = class(TJavaGenericImport<JNfcAdapterClass, JNfcAdapter>) end; /////////////////////////// NfcManager ///////////////////////////////// JNfcManagerClass = interface(JObjectClass) ['{812481E1-F491-47D2-AC1F-4C5AB509532B}'] end; [JavaSignature('android/nfc/NfcManager')] JNfcManager = interface(JObject) ['{04B707EC-966A-4E4F-85DC-F003B7C9ACE3}'] {Methods} function getDefaultAdapter: JNfcAdapter; cdecl; end; TJNfcManager = class(TJavaGenericImport<JNfcManagerClass, JNfcManager>) end; function HasNfc: Boolean; function IsNfcEnabled: Boolean; implementation function GetNfcManager: JNfcManager; var ConnectivityServiceNative: JObject; begin ConnectivityServiceNative := SharedActivityContext.getSystemService(TJContext.JavaClass.NFC_SERVICE); if not Assigned(ConnectivityServiceNative) then raise Exception.Create('Could not locate Nfc Service'); Result := TJNfcManager.Wrap((ConnectivityServiceNative as ILocalObject).GetObjectID); if not Assigned(Result) then raise Exception.Create('Could not access Nfc Manager'); end; function HasNfc: Boolean; var NfcManager: JNfcManager; NfcAdapter: JNfcAdapter; begin NfcManager := GetNfcManager; NfcAdapter := NfcManager.getDefaultAdapter; Result := Assigned(NfcAdapter); end; function IsNfcEnabled: Boolean; var NfcManager: JNfcManager; NfcAdapter: JNfcAdapter; begin NfcManager := GetNfcManager; NfcAdapter := NfcManager.getDefaultAdapter; Result := Assigned(NfcAdapter)and NfcAdapter.isEnabled; end; end. This code only provides NFC connectivity but the target devices doesn't have NFC sensors, so I can't use it. Dave Nottage sent this link, but the headers found can't provide a usefull connection with the PC/SC card reader. The manufacturer doesn't have any SDK for Android development since they stablish its use for PC only (Linux, Windows and MacOS). Facing that, till now, I was unable to successfully connect and read/write the smart card on Android.
Read More

Delphi FMX custom control – when is it safe to draw? [on hold]

Delphi 10.3.2 FMX In prior versions of Delphi, drawing on the canvas of a control would work in a TPanel's OnResize() procedure. Now it appears to be unsafe to draw in this procedure. My app draws random artifacts for the custom control while the user is resizing the TPanel (on both Windows and Macintosh). I tried setting a TTimer for drawing it later, but anything drawn in the OnTimer() procedure is also messed up. How can I safely draw a control in a TPanel's OnResize() procedure?
Read More

THTTPClient blocks after a few consecutive requests

I'm using THTTPClient in Delphi to develop an Android app. I have a big problem: after a few requests, when I do the next request it blocks like if there was a dead lock inside the THTTPClient's Post function. That's how I wake a request: I create a new THTTPClient. I do a Post request. I DisposeOf the HTTPClient. How can I solve this problem? I'm going crazy! This is the code I'm using to make a POST request: I call it from a loop and after a few request, it blocks on the line Request := HTTPClient.Post(URL, InStream, OutStream);. I noticed that when if I do request to different domains, it blocks earlier than what I do many requests to the same domain. function Post(URL: string; Data: RawByteString; var StatusCode: Integer): RawByteString; var HTTPClient: THTTPClient; Request: IHTTPResponse; InStream, OutStream: TMemoryStream; begin Try StatusCode := -1; HTTPClient := THTTPClient.Create; with HTTPClient do begin ConnectionTimeout := 10000; ResponseTimeout := 10000; UserAgent := '...'; end; InStream := TMemoryStream.Create; OutStream := TMemoryStream.Create; InStream.WriteBuffer(Data[0], Length(Data)); InStream.Seek(0, soBeginning); Request := HTTPClient.Post(URL, InStream, OutStream); StatusCode := Request.StatusCode; if (StatusCode >= 200) and (StatusCode <= 299) then begin SetLength(Result, OutStream.Size); Move(OutStream.Memory^, Result[0], OutStream.Size); end; Finally InStream.Free; OutStream.Free; HTTPClient.Free; End; end;
Read More

How to create a folder and a txt file in Delphi

How do I create a new folder in the internal storage (?) of Android (I want say, the main folder that has all the subfolders ... Whatsapp, DCIM, pictures, Ringtones, Alarms ..) and create a new .txt file inside in this folder. I want to create a .txt file and I need the user to plug the USB cable into their computer, access the device, enter the folder my application creates, and copy this file to their desktop. I tried this code to create the file: procedure TF_start.Button2Click(Sender: TObject); var output_text: string; arquivo: TextFile; begin output_text := 'test'; TFile.WriteAllText(TPath.Combine(TPath.GetDocumentsPath, 'test.txt'), 'content'); ReWrite(arquivo); WriteLn(arquivo, output_text); CloseFile(arquivo); end; But it does not work. To get the internal storage(?) path, I found this code: P := '/storage/'; if (FindFirst(P + '*', faAnyFile, Sr) = 0) then repeat Memo1.Lines.Add(Sr.Name); until (FindNext(Sr) <> 0); FindClose(Sr); But I can't understand how it works, so I can't even use it. I also found this link, but I didn't find any function that returns me the "general" directory path I want to create a folder. The functions System.IOUtils.TPath.GetHomePath(), and System.IOUtils.TPath.GetDocumentsPath() do not return me the correct path. System.SysUtils.GetHomePath() return -> /data/user/0/com.embarcadero.app/cache System.IOUtils.TPath.GetDocumentsPath() return -> /data/com.embarcadero.app-1/lib/arm @edit Using the @Remy Lebeau code and this code I managed to get to this point. The problem is that the code to update the directory with the files does nothing Use System.IOUtils, Androidapi.Helpers, Androidapi.Jni.Media, Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText; //Button procedure TF_start.Button2Click(Sender: TObject); var path_file output_text: string; begin path_file := TPath.Combine(System.IOUtils.TPath.GetSharedDownloadsPath, 'Folder_app'); output_text := 'test'; if not TDirectory.Exists(path_file) then TDirectory.CreateDirectory(path_file); try TFile.WriteAllText(TPath.Combine(path_file, Nome_Arquivo), Arquivo_saida); except ShowMessage('An error occurred while saving the file.'); end; end; Another button: procedure TF_corrida.BTNfinalize_appClick(Sender: TObject); var c: Integer; JMediaScannerCon: Androidapi.Jni.Media.JMediaScannerConnection; JMediaScannerCon_Client: Androidapi.Jni.Media.JMediaScannerConnection_MediaScannerConnectionClient; begin JMediaScannerCon:=TJMediaScannerConnection.JavaClass.init(TAndroidHelper.Context, JMediaScannerCon_Client); JMediaScannerCon.connect; c:=0; while not JMediaScannerCon.isConnected do begin Sleep(100); inc(c); if (c>20) then break; end; if (JMediaScannerCon.isConnected) then begin JMediaScannerCon.scanFile(StringToJString(path_file), nil); JMediaScannerCon.disconnect; end; end; PS This warning had appeared: [DCC Warning] u_corrida.pas(682): W1000 Symbol 'SharedActivityContext' is deprecated: 'Use TAndroidHelper.Context' So I changed the code Note: I also tried replacing "path_file" with "System.IOUtils.TPath.GetSharedDownloadsPath", but to no avail too This question has already been answered, the other question (index files and folders) has been moved to: How to index a created file in Android sdcard Delphi
Read More

delphi – Why variables are declared as TStrings and created as TStringList? – Stack Overflow

Blast from the past: [WayBack] delphi – Why variables are declared as TStrings and created as TStringList? – Stack Overflow Q Why variables are declared as TStrings and created as TStringList? A Because that way you could put another TStrings descendant in the SL variable (I’d probably call that Strings, not SL). In your case, that is moot, since the logic around SL contains the creation of a TStringList and no external assignment or parameter parsing. But if you ever split the logic away from the assignment, then you could benefit from using any TStrings descendant. For instance, a TMemoy.Lines, TListBox.Items, TComboBox.Items, etc. From the outside it looks like they are TStrings, but internally they do not use a TStringList but their own descendant. A few examples of classes that descend from TStrings: source\DUnit\Contrib\DUnitWizard\Source\DelphiExperts\Common\XP_OTAEditorUtils.pas: TXPEditorStrings = class(TStrings) source\fmx\FMX.ListBox.pas: TListBoxStrings = class(TStrings) source\fmx\FMX.Memo.pas: TMemoLines = class(TStrings) source\rtl\common\System.Classes.pas: TStringList = class(TStrings) source\vcl\Vcl.ComCtrls.pas: TTabStrings = class(TStrings) TTreeStrings = class(TStrings) TRichEditStrings = class(TStrings) source\vcl\Vcl.ExtCtrls.pas: TPageAccess = class(TStrings) THeaderStrings = class(TStrings) source\vcl\Vcl.Grids.pas: TStringGridStrings = class(TStrings) TStringSparseList = class(TStrings) source\vcl\Vcl.Outline.pas: TOutlineStrings = class(TStrings) source\vcl\Vcl.StdCtrls.pas: TCustomComboBoxStrings = class(TStrings) TMemoStrings = class(TStrings) TListBoxStrings = class(TStrings) source\vcl\Vcl.TabNotBk.pas: TTabPageAccess = class(TStrings) –jeroen
Read More

macOS 64 bit compile-ready support

Intro macOS 64 bit compilation support has been added to our products. Below is a list of products that are currently enabled to compile for macOS 64 bit TMS FMX UI Pack TMS FMX Chart TMS FMX Cloud Pack TMS FMX WebGMaps TMS FMX WebOSMaps TMS mCL TMS FNC Core TMS FNC Cloud Pack TMS FNC UI Pack TMS FNC Blox TMS FNC Chart TMS FNC Dashboard Pack We continue adding macOS 64 bit support to our other products, and will mention that in the version history whenever an update is released. macOS 64 bit compile-ready support? Our products are prepared to compile for macOS 64 bit, but this is not automatically enabled. Unfortunately, RAD Studio Rio 10.3.2 is an update that uses the same version number as older RAD Studio 10.3.* versions and therefore we have decided to not automatically install for macOS 64 bit, but make it compile-ready. To compile your applications for macOS 64 bit, please follow the steps below. Install/Update one of the products in the above list Update the macOS 64 bit library path with the path to the source files Compile/Deploy your application for macOS 64 bit by changing the target MapView TMS mCL TMS mCL originally has a MapView component that was working in a 32 bit macOS operating system and was then removed from the frameworks due to technical reasons. Now, with 64 bit, you will be able to use the MapView component again. Feedback Please provide any feedback regarding macOS 64 bit compilation support so we can further improve our products.
Read More

TMS VCL UI Pack is here, the next generation of TMS Component Pack

Since we launched TMS Component Pack back in 1998, it has been our flagship product for user interface controls for VCL based Windows application development with Delphi & C++Builder.
In the past 21 years, a lot happened. Unicode support was introduced, Win64 support added and more recently, VCL got support for (per monitor) high DPI and VCL Styles (including extra VCL styles from the DelphiStyles company). Embarcadero started offering in 2011 the FMX framework for cross platform development for which we meanwhile also developed a large number of cross platform user interface components and it became crucial to differentiate products by technology, like TMS FMX components, TMS FNC components, … and more recently also TMS WEB components…

After 21 years, we thought it was time to better align the VCL user interface components with our other product ranges and naming convention and therefore proudly introduce its successor product TMS VCL UI Pack v10.0. But there is much more to it than a name change for aligning it with other product lines. Internally we also completely moved the TMS Component Pack to a new build process that was already in use for our cross-platform FMX & FNC products.

The benefits are:

  • Moved to a new build & installer generation process allowing more frequent releases, faster rollout of improvements and fixes and also beta builds
  • Builds of full trial versions for all supported Delphi & C++Builder versions
  • In short term we will also submit a version for GetIt to facilitate download & install from the IDE itself
  • Faster migration & support to upcoming new Delphi & C++Builder versions
  • Better install/uninstall experience
  • Consistent & clear product naming
  • Focus on improvements for high DPI and VCL styles support across the entire TMS VCL UI Pack components
  • New components: Kanban board UI VCL control and TableView UI VCL control
  • Updated PDF generation library with new features
  • Keep components backwards compatible with TMS Component Pack v9.x components

A glimpse at what is new:

In TMS VCL UI Pack v10.0, we have not only 2 new VCL components but also several improvements to existing components:

  • TAdvKanbanBoard component, a highly configurable workflow visualization component
  • TAdvTableView component, a versatile & modern supercharged list control
  • PDF generation library improvements such as the capability to add rotated text
  • Support for VCL Styles

What does it practically mean?

Let there be no misunderstanding. We paid the utmost importance to make the step for you as easy as possible while moving the TMS Component Pack to our new build platform. Normally, it should be as simple as uninstalling TMS Component Pack + download and install TMS VCL UI Pack and recompile your applications with the new version. Some notes though:

  • If you use runtime packages, you will need to change the package name dependencies
  • If you use TAdvTreeView, we moved this component from using TCanvas to TAdvGraphics. When opening form files using TAdvTreeView, ignore possible property errors, save the form file and recompile.
  • If you use C++Builder, you will need to change the linked library name references in your project

We have summed up these steps in detail in a file migrate.txt that is included in the TMS VCL UI Pack install folder.

Moving to TMS VCL UI Pack

TMS VCL UI Pack v10.0 is the new product name for TMS Component Pack v10.0. This means all users entitled to get TMS Component Pack v10.0 automatically receive TMS VCL UI Pack v10.0. Also, users with an active subscription to TMS ALL-ACCESS, TMS VCL Subscription or TMS Component Studio receive TMS VCL UI Pack v10.0 automatically.

For your convenience, for a while we will simultaneously keep offering access to TMS Component Pack v9.x.
So, users with an active TMS Component Pack license will get both TMS Component Pack v9.x and TMS VCL UI Pack v10.x and users purchasing a TMS VCL UI Pack license or upgrading to TMS VCL UI Pack will also still get access to TMS Component Pack v9.x. Of course, as it concerns mostly the same components, these cannot be simultaneously installed in the IDE. But if, for one of the reasons above, a migration would require some work on your side to change package name references for example, you can freely chose when to plan this change and continue to use TMS Component Pack v9.x till you have time and are ready to switch to TMS VCL UI Pack.

What’s next

First of all, with our processes streamlined here, we will be even more efficient & productive to roll out new TMS VCL UI Pack versions with new features, new components and improvements more frequently and faster. The new naming convention should bring more clarity as to what technology the product can be used with. Similar work has been started here already for other TMS VCL products and all will get the TMS VCL xxx productname nomenclature in the coming months.

Feedback

Still having questions, comments or feedback? Don’t hesitate to leave a comment here on the blog or contact support for all questions and suggestions or sales for questions related to upgrading to TMS VCL UI Pack from older TMS Component Pack licenses or smaller VCL component bundles. We look forward to hear from you!

Read More

Read More

How to Change "capturing voice quality" in delphi firemonkey

I need to change captured voice quality programmatically to reduce file size , because of if I use default setting and start capturing voice it will reduce wave file that 1 minute recorded = more than 20 MB , so I need to change the quality of recording sitting to reduce file size. Nothing found to tried , the code is worked well , but I need only to decrease recorded file size, by changing the quality of recording voice setting. procedure TForm1.RecordButtonClick(Sender: TObject); begin // Get the default microphone try Mic := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice; if Mic <> nil then begin // Set the SaveDialog filter to choose only the supported extension SaveDialog1.Filter := Mic.FilterString; if SaveDialog1.Execute then begin RecordButton.Enabled := false; StopButton.Enabled := true; // Gets the name of the file where to save the recorded data Mic.FileName := SaveDialog1.FileName; Mic.StartCapture; end; end else begin ShowMessage('Audio capturing device not available'); end; except on E: Exception do ShowMessage(E.Message); end; end; procedure TForm1.StopButtonClick(Sender: TObject); begin try if (Mic <> nil) and (Mic.State = TCaptureDeviceState.Capturing) then begin Mic.StopCapture; StopButton.Enabled := false; RecordButton.Enabled := true; end; except on E: Exception do ShowMessage(E.Message); end; end;
Read More