We help IT Professionals succeed at work.

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.

Hi Guys,

The idFtp has an important event that gets the results, I don't know how to set / use the event when I create the idFtp in runtime. I need to
an example for it.  Below you can see my code and use it to give me an example.

Thanks a lot

  Function RunFTP( FtpServidor ,  FtpUsuario, FtpSenha, FtpPorta,  FtpAutentica, FtpCaminhoUpload, FtpCaminhoResposta: String): Boolean;

  Result := True

  if EstaVazio(FtpServidor) or EstaVazio( FtpUsuario ) or EstaVazio( FtpSenha ) or  EstaVazio( FtpAutentica ) or
     EstaVazio( FtpPorta )  {or EstaVazio( SmtpCaminhoUpload ) or EstaVazio( SmpCaminhoResposta )} then Begin
     ShowMessage('As configurações de FTP não estão completas no parceiro: ' + CodCad);
     Result := False;
     Exit;
  End;


  if FtpAutentica = '1' then
     FtpAut  := true
  else
     FtpAut  := false;


  IdFTP1 := TIdFTP.Create();
  IdFTP1.Disconnect;

  IdFTP1.Host     := FtpServidor;
  idFTP1.DirectoryListing.DirectoryName:= FtpCaminhoUpload;
  IdFTP1.Port     := Strtoint(FtpPorta);
  IdFTP1.Username := FtpUsuario;
  IdFTP1.Password := FtpSenha;
  IdFTP1.Passive  := FtpAut;

  try
     IdFTP1.Connect;
  except
     IdFTP1.Disconnect;
     IdFTP1.Connect;
     Result := False;
     Exit;
  end;

  BarraRotina('UP',Carquivo+iif(Tipo = 'Upload',' Envio ',' Recebimento ')+' de Arquivo '+Carquivo,0,0);

  Try
    Try
      if Tipo = 'Upload' then begin
         IdFTP1.Put (cArquivo, FtpCaminhoUpload+Carquivo, true);
      end else if Tipo = 

Open in new window

0
In my Delphi application, I determine the current directory by SysUtils.GetCurrentDir function. Of course, when the app is run, the current directory is the folder in which the installer put MyApp.exe file. By default, it is C:\Program Files\MyApp

Everything looks different now, after I packed my program in appx, in order to make a UWP application and submit it to Microsoft Store. Now the app goes to the folder C:\Program Files\WindowsApps\MyApp_1.0.0.0_x86__sp51hrchc9zqj.  However, the function GetCurrentDir returns a different address which is C:\WINDOWS\system32

What can I do about it? I need the address of the folder where the exe file is!
0
I´m running a miniature callcenter with business clients who use Microsoft Office 365 as their enterprise calendar system. The clients usually have anything from 10 to 200 employees using O365 calendars. I need to be able to get our callcenter program to tap into the client´s calendars and retreive information (free/busy is most important).

Some background info that may be useful: We run FreePBX (Asterisk) as our telephony platform. Our agents use an in-house developed program to handle the calls and get info about the clients. The program is fully customizable (developed in Delphi) and talks with a MySQL db where all the client info is stored.

When our callcenter agent gets a call to one of the client´s phone number, the client´s company info is displayed together with a complete listing of all the employees. We currently have no way of telling if the employee is free or busy, as we cannot access their calendar. I would need to get that information added to the employee info in our MySQL db. Perhaps synchronized once every 5 minutes.

How would you suggest me to go about this? I accept suggestions to 3rd party plugins (for example for Delphi). Freelance gig may also be accepted.

Thanks and sorry about my bad english.
0
I have several documents that are actually *.rtf files, but the extension was changed to *.doc.
Now I need to know if it is actually a *.rtf or a real *.doc file.

So I'm looking for a Delphi function that will determine if a document-file internally is ​a *.rtf of *.doc file.
The function should handle older version of word documents too (like Word 98).
0
Hello,

I’m looking for a solution that allows me to convert *.doc or *.docx to *.pdf within Delphi DX10 Berlin / Tokyo Enterprise.
The solution should work even if MS Word isn’t installed on the users system.

Basically sending the Word-document to printer "Microsoft print to PDF" would do the trick for me. But all without any user interaction.


Thanks!
0
Hi can you tell me how to add Combo box in to Adv String grid
Ex
i need to add Col 1 Combobox 1, Col2 need to add Combobox 2
0
Hi

following scenario:
- Delphi 10.1 Berlin
- SQL Server Database with a table "myTable", two columns "colA" and "colB"
- Open the table with SELECT colA, colB, colA * colB AS multiplyResult FROM myTable
- Form with a tDbGrid, showing all the columns

Know my question: I want to modify colA or colB (in the tDnGrid) and want that the result is displayed immediately. Is there a possibility to refresh only that calculated value without calling the refresh-method of the query (after the refresh I have to locate the row again and if it is a large table it is a performance-problem)?

Thanks for your hints, Peter
0
I am looking for an easy way to verify that the PC where my program is running is connected to the Internet.
The program is mine and coded in Delphi XE
Thanks
0
When I try the program below I get
error  "OLE error 800A03EC"
When I put the formula
=SOMMEN.ALS(R[-8]K:R[-2]K;R[-8]K[-1]:R[-2]K[-1];">100";R[-8]K[-1]:R[-2]K[-1];"<200")
manualy in the Excel sheet on cell (11,2) everyting is ok.
In the attachment the test.xlsx file.

===================

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComObj, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var ExcelApp : variant;
begin
  ExcelApp:= CreateOleObject('Excel.Application');
  ExcelApp.DisplayAlerts := False;
  ExcelApp.Workbooks.Open('c:\users\myself\temp\test.xlsx');
  //"=SOMMEN.ALS" is Dutch version of "=SUMIFS"
  ExcelApp.ActiveWorkbook.WorkSheets[1].Cells(11,2):='=SOMMEN.ALS(R[-8]K:R[-2]K;R[-8]K[-1]:R[-2]K[-1];">100";R[-8]K[-1]:R[-2]K[-1];"<200")';
  ExcelApp.Visible:=True;
end;

end.
test.xlsx
0
I want to have the background color of a particular TStringGrid cell to be for example Red when I write a string in that cell.
What is the instruction I have to place in the TStringGrid OnDrawCell event ?
0
Can I use Delphi 10.2.2  FireDac TFDLocalSql   with Firebird ?
0
I had this question after viewing Image On A TButton.

I have the same problem, but, I don't know why, few days ago it worked until I did something wrong in Project Option or somewhere, I presume,and then no chanche to see a TButton with an image inside in my app (only button). In a new app it works (Win10 Rad Delphi 10,2) May be the problem is in the attached file, but......
0
Using Delphi, I have a client / server application which requires an Indy (from 2016) based connection. The problem scenario is very specific. During a data transfer from the Server, the Server disconnects. Indy recognizes this and Raises an Exception (usually 10054) but can fall in to an infinite loop, where it just continues to raise the same Exception over and over again. This exception is only seen in Debug mode, so just appears as an infinite loop to a client. I have a Try / Except block surrounding the test operation in an attempt to catch the Exception but it never exits.
0
Hi all,

I am trying to create a very simple thread . I want to create a file if it does not exists . And only one thread may run at a time , even if I have 5 threads waiting .

unit FilemuxThread;

interface

uses System.Classes, System.SysUtils, Winapi.Messages, VCL.Forms, Winapi.Windows;

type
  TFilemuxThread = Class(TThread)
  Public
    constructor Create(Rack: String; Glas: String; EsBC : string; XLR_Node : string);
  protected
    tRack: string;
    tGlas: string;
    tEsBC: string;
    tXLR_Node: string;

    procedure Execute; override;
  end;

var isDone : boolean;

implementation

uses inifunctions, DateUtils, MainForm;

constructor TFilemuxThread.Create(Rack: String; Glas: String; EsBC : string; XLR_Node : string);
begin
  inherited Create(False);

  FreeOnTerminate:=True;
  tRack:=Rack;
  tGlas:=Glas;
  tEsBC:=EsBC;
  tXLR_Node:=XLR_Node;


  PostMessage( Main.Handle, TH_MESSAGE, 10, 1);

end;

procedure TFilemuxThread.Execute;
var mypath : string;
    mytimestamp : TDateTime;
    myFile : TextFile;
begin
  inherited;

  try
    while isDone = false do
      begin
        if fileexists(ExtractFilePath(Application.ExeName)+'\Temp\Line5.dat') = false then
          begin
            mypath := iniread('setup.conf','options','file');
            mytimestamp:=date+time;
            AssignFile(myFile, ExtractFilePath(Application.ExeName)+'\Temp\Line5.dat');
            ReWrite(myFile);

            

Open in new window

0
I have Delphi XE8 and I am trying to view large text files. In Delphi 7, there was a component called, I believe TFileView, which performed such a function.

Are there any suggestions as to how to view large text files and mark "found" (SelStart, SelSelLength) words in a different colour?

I tried using TRichEdit, but it is extremely slow.

Thank you. :-)
0
In a TEdit field, when the user changes it, I want the Onchange Event to modify the content of the Text and place the cursor at the end of it.
0
Hello, I want to color every cell of a stringgrid without using the OnCellDraw event in a button for example is there a solution for that? I m using Delphi 7 and sorry for my bad english  Thanks.
0
I'm using Delphi 2010. When using FindFirst, FindNext I am aware that TSearchRec gives useful information such as: Name, Size, Date-Time, Attributes from a file.
My question is: How can I obtain the Size and Date/Time information of an archive when using TDirectory from IOUtils? For example, something as simple as this:

var
   lFiles:TStringDynArray;
   sPath:String;
   lAttributes:TFileAttributes;
   nSize: Int64;
   dFileDate: TDateTime;

begin

   lFiles := TDirectory.GetFiles( 'c:\temp\', '*.*', TSearchOption.soAllDirectories );

   // sPath contains the File Name and the complete path
   sPath := lFiles[0];

   If TFile.Exists( sPath ) then begin

      // TFile Attributes
      lAttributes := TFile.GetAttributes( sPath );

      If ( TFileAttribute.faArchive in lAttributes ) then begin

         // Now retrieve the File Size
         nSize := ???

         // Now retrieve the File Date/Time
         dFileDate := ???

     end;
   end;
end;

Open in new window

0
Hello,

I need to recognize special pictures in my app and depending what picture it recognized I need to start different outcomes.
Is there a method or component to use the phone's camera for reading a picture and then recognize it?

(it needs to run for both Android and iPhone).

Thank you
0
Hello,
I want to select data from table paradox from (Date1,Time1) to (Date2,Time2) for example from 01/02/2018 time:22:00:00 to 14/02/2018 time 09:00:00 i'm using delphi 7
0
I have a dll written in Delphi that I need to call from a c++ program. My dll works when called from Delphi, both when using static and dynamic loading. However, in c++, LoadLibrary returns a null pointer. In both cases, test.dll is located in the same dir as the test program. I am a c++ beginner - any help is appreciated.

The dll:
library test;

uses
  System.SysUtils,
  System.Classes;

{$R *.res}
 function AddIntegers(_a, _b: integer): integer; stdcall;
begin
  Result := _a + _b;
end;

exports
  AddIntegers;

begin
end.

Open in new window


The Delphi test program - this return the line "3 + 4 is 7", as expected:
program SimpleDLLTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, Winapi.Windows;

type
  TAddIntegersFunc = function (_a, _b: integer): integer; stdcall;
var
  DllHandle : HMODULE;
  AddIntegersFunc : TAddIntegersFunc;
  TestInt         : integer;
begin
  try
    DllHandle := LoadLibrary(pWideChar('test.dll'));
    if DllHandle = 0 then begin
      Writeln('Error loading dll');
    end else begin
      @AddIntegersFunc := GetProcAddress(DllHandle, 'AddIntegers');
      if assigned(AddIntegersFunc) then begin
        TestInt := AddIntegersFunc(3,4);
        Writeln('3 + 4 is ' + IntToStr(TestInt));
      end else begin
        Writeln('Function not found');
      end;
    end;
    Write('Press Enter'); ReadLn;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Open in new window


The c++ test program:
#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
	HINSTANCE hGetProcIDDLL = LoadLibrary("test.dll");

	if (!hGetProcIDDLL)
	{
		cout<<"Could not load library!\n";
		cin.get();
	}
	else
	{
		cout<<"Library loaded!\n";
		cin.get();
	}

	return 0;
}

Open in new window


I did not write any function call in c++, since I have not yet even managed to load the library - I just get "Could not load library".
0
Hi Experts,
I have two delphi apps say app1 and app2,  both are exes.
I run one app2 from app1 by shellexecute command.
How can i pass a function of app1 inside shellexecute command so the function result is available to app2.
0
Hello! I'm using D2010. When I used FidFirst / FindNext to search folders and/or files, I was able to access the TSearchRec info easily. However, when I use TDirectory.GetFileSystemEntries and TDirectory.GetDirectories (I reckon these calls are simpler and faster!) I only receive the folders and files names. My question is if I can have access to the complete record (FileSize, FileDateTime, FileAttributes...) using TDirectory, and how. Thanks in advance
0
How can i know if an is running via a hosted environment say citrix server?

So i can run a delphi app in local machine or via citrix server. When running through citrix server the application should run straight away and while running from the local machine it should ask for login credentials.

How to do this, any clue please?
0
I had this question after viewing Pascal Helo.

i had this script
unit hospital;
interface

implementation
uses crt;
Var
name:string;
typeofroom,tp,tv,nory1,nory2:char;
month, day, year, daysstayed,roomcharge,tpcharge,tvcharge,totalcharge:integer;

const
pc=125;
sc=95;
Wc=75;
Tvc=3.50;
Tpc=1.75;
begin
//prompting
writeln('please enter the patients''s name':44);
readln(name);
writeln('please enter the number of days stayed in the hospital':63);
readln(daysstayed);
writeln('please write the month':31);
readln(month);
writeln('please write the day':29);
readln(day);
writeln('pelase enter the year':30);
readln(year);
writeln('please enter y or n for which typeofroom you used. P for private, S for semi private, and W for ward':57);
readln(typeofroom);
Case typeofroom of 'P':roomcharge:=(pc*daysstayed);
                   's':roomcharge:=(sc*daysstayed);
                   'w':roomcharge:=(wc*daysstayed);
end;
writeln('enter y or n for yes or no if they used the telephone':62);
readln(nory1);
Case nory1 of 'Y':tpcharge:=(tpc*daysstayed);
                 'N':tpcharge:=0;
end;

writeln('enter y or n for yes or no if they used the television':63);
readln(nory2);
Case nory2 of 'Y':tvcharge:=Tvc*daysstayed;
                 'N':tvcharge:=0;
end;
//computing
Totalcharge:=roomcharge+tvcharge+tpcharge;


end.
and the error Error: Incompatible types: got "S80REAL" expected "LONGINT"
2 times
plz help me fix it
thanx
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.