Go Premium for a chance to win a PS4. Enter to Win

x

Delphi

59K

Solutions

17K

Contributors

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi

Delphi 10.1 Berlin
I have written an app to monitor a folder (new files, delete files) and it does not work in some cases.
- locally it works
- if i start the application on PC1, monitor a folder on the server, add a file in that folder on PC1 it works
- if I add a file to that folder but on the server (not PC1) it does not work (but on some networks this also works!). If I have open the file explorer on PC1 I can see the added file some ms later - but my app doesn't show it.
My code
procedure TForm31.FormCreate(Sender: TObject);
var
    isf : IShellFolder;
    Eaten, attr : DWord;
    pidl : pItemIDList;
begin
  snh := TShellNotifyHandler.Create(self);
  snh.OnShellNotify := ShellNotifyHandler1;
  snh.ShellMsg := WM_User+100;
  snh.Events := [seDelete, seRenameItem, seCreate];
  snh.Recursive := true;
  SHGetDesktopFolder(isf);
  isf.ParseDisplayName(self.Handle, nil, PWideChar(ExtractFilePath(ParamStr(0))), Eaten, pidl, attr);
  label1.Caption := ExtractFilePath(ParamStr(0));
  snhHandle := snh.RegisterPIDL(self.Handle,pidl);
end;

procedure TForm31.ShellNotifyHandler1(Sender: TObject; LEvent: TShellEvent;
  pidl1, pidl2: PItemIDList);
var
    SRec: TSearchRec;
    Res : integer;
begin
  ListBox1.Clear;
  Res := FindFirst(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'*.*', faAnyFile, SRec);
  while Res = 0 do
  begin
    if (SRec.Name <> '.') and (SRec.Name <> '..') then
      ListBox1.Items.Add(SRec.Name);
    Res := FindNext(SRec);
  end;
  

Open in new window

0
TBannerAd can't load via LoadAd in Delphi 10.2 Tokyo - Firemonkey Android.

Uses Permissions - OK

Access network state

Internet

AdMob Service = True for Project/Options/Entitlement List - OK

AdUnitID - OK

procedure TForm1.FormCreate(Sender: TObject);
begin
BannerAd1.AdUnitID:='ca-app-pub-3940256099942544/6300978111';
// AdMob Banner Sample ad unit ID
// Also I tried for my real AdUnitID
end;

Open in new window


My sample code for to try - OK

procedure TForm1.Button1Click(Sender: TObject);
begin
BannerAd1.LoadAd; 
end;

Open in new window


I used AdMob for my old project in different Delphi version.

There didn't any problem for this.

But, my application is freezing for a time and TBannerAd can't load via LoadAd for this project.

Log monitor is giving this error for this problem.

The Google Play services resources were not found.

Check your project configuration to ensure that the resources are included.
0
to be more specific slow connection client got disconnected from the server when write memorystream with this code in on execute event
 if OutboundCmds <> nil then
    begin
      for I := 0 to OutboundCmds.Count - 1 do
      begin
 
        AContext.Connection.IOHandler.Writeln(OutboundCmds.Strings[I],
          IndyTextEncoding_UTF8);
 
 
        MS := TMemoryStream(OutboundCmds.Objects[I]);
        if MS <> nil then
        begin
          AContext.Connection.IOHandler.LargeStream := true;
          AContext.Connection.IOHandler.Write(MS, 0, true);
        end;
      end;
 
    end;
 
  finally
    if OutboundCmds <> nil then
    begin
      for I := 0 to OutboundCmds.Count - 1 do
      begin
        OutboundCmds.Objects[I].Free;
      end;
    end;
    OutboundCmds.Free;
  end;

Open in new window


specially here
 MS := TMemoryStream(OutboundCmds.Objects[I]);
        if MS <> nil then
        begin
          AContext.Connection.IOHandler.LargeStream := true;
          AContext.Connection.IOHandler.Write(MS, 0, true);
        end;
      end;

Open in new window


clients with good connection speed don't have any problems . what could be the problem with slow internet ?

if i remove the memory stream write they dont get disconnected and remains connected
0
I need to update a datum but change to each record in mastersource.
datamod.TTGiacenzaMangimeQtascarico.Value is a value that must be incremented.
Currently, if the record change (the ones shown on the left in the photos), the value of datamod.TTGiacenzaMangimeQtascarico.Value changes with
scaricototale: + = scaricototale datamod.PollaioTScaricoMangime.Value , and you should upgrade and increase.

It should increase at each record change. You have to upgrade.
How to do ?
Thank you

Image 1 procedureImage 2 procedure
procedure Tdett_form.calcolaGiacenza;
var
scaricoTotale,scaricogen:extended;
begin
 try
  DataMod.PollaioT.DisableControls;
   scaricototale:=0;
  datamod.PollaioT.Filter:='Nome='''+Nomeedit.Text+'*''';
  datamod.PollaioT.Filtered:=true;
  DataMod.PollaioT.First;
    while not DataMod.PollaioT.Eof do
    begin
      scaricototale:= scaricototale+datamod.PollaioTScaricoMangime.Value;
      DataMod.PollaioT.Next;
    end;
     If datamod.PollaioT.Locate('Articolo',datamod.TTGiacenzaMangimeArticolo.Value,[locaseinsensitive]) then
     begin
     datamod.TTGiacenzaMangime.Edit;
     datamod.TTGiacenzaMangimeQtascarico.Value:=scaricototale;
     datamod.TTGiacenzaMangime.Post;
     end;

finally
  DataMod.PollaioT.enableControls;
  datamod.PollaioT.Filtered:=false;
end;
     end;

Open in new window

0
My application loads ms access database table from my desktop. I wish be able to transfer this table to my domain(I have what I need to access this domain).
Please help me to do the following:
1. copy my table (Ms Access) to my site.
2. have the ability to edit this table and save it again.
3. have  the location address of  this table so I can load with my app.
4. Inside My app, I have no difficulty to use this table (Iam using FireDac of Delphi 10 seatle)
5.other options than using my site to publish my database are welcome
thank you in advance
0
Hi
I havean ACCES DB with Delphi. I open the Db from a  menuline open DB. The I have a menuline to close de DB. So I can use different DB for each year.
When I run my software from delphi (execute) it run properly but when i close the Database and without to return to Delphi, if I trie to open it again, I have nothing in my Different db grid. So it seems that it is not open but I haven't any error mesage just blank dbgrid an d DBtext component.
Any idee? Beacause if I close le DataBase and reopen it again it schould work.
Regards
Claude
0
Below is a snippet from a REST server application that I have written in Embarcadero C++ builder XE10.1 Berlin

void TWebModule1::Action1Get(TWebRequest *Request,TWebResponse *Response)
{
  Code here generates some JSON response based on the Request.....

// send the response
Response->ContentType 	= u"application/json";
Response->Content       = ... some JSON text

}

Open in new window


I wish to modify the REST server so as to return some html text in another Action handler but I need to know the value to assign to the Response->ContentType instead of "application/json"
Also what other values are valid Response->ContentTypes ?
0
Hello,

I tried this : http://blog.marcocantu.com/blog/xe5_anonymous_showmodal_android.html

and my problem is that using this code:

var
  dlg: TForm1;
begin
  dlg := TForm1.Create(nil);
  // select current value, if avaialble in the list
  dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(Edit1.Text);
  dlg.ShowModal(
    procedure(ModalResult: TModalResult)
    begin
      if ModalResult = mrOK then
      // if OK was pressed and an item is selected, pick it
        if dlg.ListBox1.ItemIndex >= 0 then
          edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
      dlg.DisposeOf;
    end);

Open in new window


The  dlg.DisposeOf; gives Access Violation error.
I tried it with Free, but that gives the same error message.

How can I free the form then? Thank you.
0
Hello,

I bought Tms Fmx component and I am struggling with simple things.

I use TMSFMXLiveGrid which is connected to a datasource.
It automatically populated the columns.
But I want certain columns to show certain fields. However, when I click a column's properties in Object inspector I can't see field name property.
How can I set that a column should use a certain field?

Thank you.
0
How to check for available space?
For example, unable to copy file to Mobile Device. There is an Mobile Device Copy Error. It is necessary to find out the reason, whether it happened because of a lack of available space.
0
I succesfully wrote my first Delphi app for smartphone (Android).
A button to click, a edit field, a label
When clicking on the button, the text in the edit field is copied in the label text : Label1.Text := 'Hello ' + Edit1.Text + ' ! ';
Also, at design time, I put "Hello" in the text property of Label1
Now at execution time (test on the PC),  clicking the button has no effect !
In debug mode, I put a break point on the statement label1.Text := ... but it never stops there
What's missing ?
Here is the code of Unit1 :

unit Unit1;
interface
uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Controls.Presentation, FMX.Edit;
type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;
var
  Form1: TForm1;
implementation
{$R *.fmx}
// {$R *.iPhone47in.fmx IOS}
procedure TForm1.Button1Click(Sender: TObject);
begin
 Label1.Text := 'Hello ' + Edit1.Text + ' !';
end;
end.
0
I have a IdHTTPServer and i want implement the support for handle both http and https request. There are my consig

FSSLHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil);
FSSLHandler.SSLOptions.CertFile     := 'certificate.pem';
FSSLHandler.SSLOptions.KeyFile      := 'key.pem';
FSSLHandler.SSLOptions.RootCertFile := 'chain.pem';

FIdHTTPServer.Bindings.Add.Port := 443;
FIdHTTPServer.IOHandler := FSSLHandler;

FIdHTTPServer.Activate := true;

Open in new window


in the server directory i have ssleay32.dll and ssleay32.dll v1.0.2l (Win32) downloaded from http://indy.fulgan.com/SSL/

when i make a request from Chrome, in the security tab of the developer tool i see:

YLrb4.png
Also, analyzing the server with sslyze i have some others security issue (see VULNERABLE label):

> sslyze --regular local.XXXXXXXXXXXXXX.com:4343

SCAN RESULTS FOR LOCAL.XXXXXXXXXXXXXX.COM:4343 - 127.0.0.1
 --------------------------------------------------------

 * SSLV2 Cipher Suites:
      Server rejected all cipher suites.

 * TLSV1_1 Cipher Suites:
     Preferred:
        None - Server followed client cipher suite preference.                                                            
     Accepted:
        TLS_RSA_WITH_AES_256_CBC_SHA                      -              256 bits                                                                  
        TLS_RSA_WITH_CAMELLIA_256_CBC_SHA                 -              256 bits                                    
0
Hi,

In SQL Server Express I have a Stored Procedure that will rebuild or reorganize indexes based on their fragmentationlevel.
See: http://sqlfool.com/2011/06/index-defrag-script-v4-1/
This process might take a considerable amount of time in a big database.
This script uses some parameters, but I can set them all to defaults, so I can skip that part.

When my Delphi application starts the procedure, it will wait for completion, resulting in Time-out for query errors. I could extend the time-out but I would still have to wait for completion. Which I don't wait.

I only want to start the procedure and work in my application again. I need no result back. Let SQL Server do the work in the background. The SP has it's own timelimit which can be set.

How can I set this up in a way that meets my needs?
Please keep in mind that I run on SQL Server Express, which might limit my options.
0
I am programming in Delphi XE8 and have been looking for some time for software that I can call from my program that can convert from as many formats as possible to text or RTF.

Any suggestions?
0
Hi! I've been programming for several years in Delphi, then C++Builder but recently I started programming concurrrently(threads)
I've read on documentation VCL should be used by "synchronice" method. My question: all of the objects from VCL should be
treated within a Synchronice call or only when severals threads use the same object or only when they affect the GUI(labels, buttons
and others properties)?. Suppose I have n threads but each one of them use their own objects(labels, tlistbox, etc) inside a TPage for each one, so there's a TPageControl for all of them should I use Synchronize?
0
Hi there,

I made a small win32 db-applicatie for warehouse for education a couple of years ago (Delphi 2007), using ADO en msaccess db.
Since a couple of months two things happen with the application:

1 slow start up and slow shut down in win10. In DELPHI IDE it 'hangs' on olepro32.dll.
2 i can't reproduce but some win10 user get errors (external exception / access violations)

I read something about how MS after june 2017 updates dll's.
Could that have anything to do with this?

Every help appreciated.
0
I use a TIDMessage component (M) to read emails in a Delphi application
Sometime I get as unique first line of the body (M.Body[0]) this : "This is a multipart message in MIME format"
Where can I get the real body of this message ?
Thanks !
0
need some help with this batch script
I use alwaysup.exe to run my .exe as system ,here u can see some pugins:  https://www.coretechnologies.com/products/AlwaysUp/Plugins/

I decide to use this plugin:
Stop/restart your application if a specific string is found in a log file

Command Line Usage
	CheckLogFileForFatalError.exe <file-name> -e <error-string>
		[-ok <ok-string>] [-v]
where
	<file-name> is the full path to the file to be checked
		- Please enclose in quotes if the path contains spaces.
		- Note that this file name can contain special macro-like
		strings that will be dynamically replaced when the program
		is run. These are:
			$DAY == The current 2-digit month (01-12)
			$MONTH == The current 2-digit day (01-31)
			$YEAR2 == The current 2-digit year
			$YEAR4 == The current 4-digit year
		For example, if today is May 26 2011, then:
			C:\Files\Myfile_$MONTH_$DAY_$YEAR4.log
		will be expanded to
			C:\Files\Myfile_05_26_2011.log
		when the utility is run.

	<error-string> is the error message to look for in the file
        There can be multiple error-strings, and at least one must be specified.

	<ok-string> is a message that signals that the software is ok.
        If it appears after all the error strings, a restart will not be
        signaled. An ok-string is not required but multiple can be specified.

	-v signals to produce verbose output (optional)

        Note: All strings are case sensitive.
Example
To check if a log file located at 

Open in new window

0
Hello!

I have a problem, when I1m trying to get a https image from a web site. The page uses TLS 1.2, so I use OpenSSL and it works for all the text I want to get from the page. When it comes to the picture, then I get the "underlying crypto error, error connecting with ssl, error 1409442E: SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version.

Does anyone have any idei what is causing this? I've tryed more SSL/TLS versions, but none of them worked. I use the latest dlls.

Thanks for any help in advance!
0
Hello,

I have made an Android app in Delphi which sends Sms to some phone numbers.

It works well on my phone but at one of my customer (who has Android 7 on his phone ) it works like this:
- it sends about 10-15 SMS-es without error
- then "Android error: java.lang.UnsupportedOperationException: Sms is not supported" pops up

What can cause the problem at customer's site?
Thank you very much for your help.
0
How to Fix compress file I used ZLib  in Delphi 10.2
0
Hi,
I am using QuickPDF (DeBenu) to fill a PDF form and all is working well except checking a radio-button.
What is the correct syntax (any language) to check the first radio-button in the following group:
* * * * * * * *
Field10: form1[0].#subform[0].period_1[0]
Field 11: form1[0].#subform[0].period_1[0].PaymentPeriodM[0];    Value=Off
        11:1. Off
        11:2. 0
        11:3. 1
Field 12: form1[0].#subform[0].period_1[0].OtherSpecify[0]
* * * * * * * *
Many thanks,
-Itai
0
i have Tpagecontrol with 5 tabsheet. example i work in tabsheet4.  is it possible to close the tabsheet4 in runtime mode? i mean when i run the program, i can easily close the tabsheet4 (like in browser such firefox or elese). and when i want to see the tabsheet4 i can open it again using button or navbar, is it possible?

many thax
0
Hello guys

I have this link :
http://apps.widenet.com.br/busca-cep/api/cep/09780-470.xml
and it returns me this xml in my browse:

<cep>
<status>1</status>
<code>09780-470</code>
<state>SP</state>
<city>São Bernardo do Campo</city>
<district>Nova Petrópolis</district>
<address>Rua Dom Bernardo José Bueno Miele (Jd Palermo)</address>
</cep>

Open in new window


I am trying to get it in my delphi code, but I am having problem with it, this is my function:

function RetornoHttpGet(sEndereco: String): String;
  var
    s,str: string;
    IndIni: integer;
    IndFim: integer;
    acesso: TIdHTTP;
begin


  acesso := TIdHTTP.Create(nil);
  acesso.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(acesso);
  acesso.Request.Accept := 'text/html, */*';
  acesso.Request.UserAgent := 'Mozilla/3.0 (compatible; IndyLibrary)';
  acesso.Request.ContentType := 'application/x-www-form-urlencoded';
  acesso.HandleRedirects := True;
  try
    s := acesso.Get(sEndereco);
    freeandnil(acesso);
    Result := s
  except
    Result := '';
  end;

end;

Open in new window


could you help me on this?
I got this error: HTTP/1.1 403 Forbidden

Thanks
Alex
0
I have TadvNavBar and pagecontrol1, in TAdvNavBar1 i have 3 panels ( AdvNavBarPanel1, AdvNavBarPanel2, AdvNavBarPanel3) and in page control there are 3 tab (tabsheet1, tabsheet2 , tabsheet3), is it possible when i click AdvNavbarPanel1 = tabsheet1 active, and so on with Advnavbarpanel2 and Advnavbarpanel3..

this is my sintax but its get error:

procedure TForm1.AdvNavBar1Click(Sender: TObject);
begin
pagecontrol1.ActivePageIndex:=Tadvnavbar(sender).Panels
end;

anyone can help?
0

Delphi

59K

Solutions

17K

Contributors

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.