Delphi

59K

Solutions

16K

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

I am using tidtcpserver to receive continuously stream and text from a client.

I wanted to enhance my current protocol to safely receive merged data from a client weather its memory stream or string

here is my current protocol

procedure TForm1.TcpSExecute(AContext: TIdContext);
var
  Params: array [1 .. 200] of String;
  Connection: TConnection;
  Command: String;
  ParamsCount, P: integer;
  MS: TMemoryStream;
  ReceiveParams, ReceiveStream: BOOLEAN;
  I: integer;
  DECODES: String;
begin
  Connection := AContext as TConnection;
  Command := AContext.Connection.Socket.ReadLn(IndyTextEncoding_UTF8);
  ReceiveParams := False;
  ReceiveStream := False;

  if Command[1] = '1' then // string command
  begin
    Command := Copy(Command, 2, MaxInt);
    ReceiveParams := true;
  end
  else if Command[1] = '2' then // string + stream
  begin
    Command := Copy(Command, 2, MaxInt);
    ReceiveStream := true;
  end;

  if ReceiveParams then // String is incomming
  begin
    S := AContext.Connection.Socket.ReadLn(IndyTextEncoding_UTF8);
    DECODES := Decode64(S, IndyTextEncoding_UTF8);

    ParamsCount := 0;
    while (DECODES <> '') and (ParamsCount < 200) do
    begin
      Inc(ParamsCount);
      P := Pos(Sep, DECODES);
      if P = 0 then
        Params[ParamsCount] := DECODES
      else
      begin
        Params[ParamsCount] := Copy(DECODES, 1, P - 1);
        Delete(DECODES, 1, P + 5);
      end;
    end;
  end;

  MS := nil;
  try
    if ReceiveStream then // 

Open in new window

0
On Demand Webinar: Networking for the Cloud Era
LVL 9
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Hello,
i'have question about reporting service reportservices,I'm trying to connect to the reporting  web service sql server but an exception is raised, password or user are wrong error 401 unauthorized .
But i'm sure that they are correct this is how i use it :
I have imported a wsdl and i have got reportservice2005.pas.
Why i can't Authentify knowing that i can with browser how to use the methode LogOnUser() ? or THttpRio? to authtify.
this is the procedure i'm using :
procedure TfMenu.Button1Click(Sender: TObject);
 const
   defURL  = 'http://khali-pc:80/ReportServerSQL2016/ReportService2005.asmx';
var
   Report : CreateReport;
   ReportingService :  ReportingService2005Soap;
   stream           :   TFileStream;
   tailleBuffer,I     : Integer;
   UserLog          : logonUser;
   Rio1              : THttpRio;

begin
 
 Rio1 := THttpRIo.Create(self);
   Rio1.HTTPWebNode.UserName      := 'SomeDomain\SomeUser';
   Rio1.HTTPWebNode.Password      := 'xxxxxxx';

ReportingService := GetReportingService2005Soap(false, defURL, nil) ;

/////********** Second way to authenificate*********************// PS: and the first way to athentificate is to include password and user in RIO (THttpRio) above

/// second method to authetify to SSRS
//   UserLog                  :=       LogonUser.Create;
//   UserLog.userName  := 'SomeDomain\SomeUser';  
//   UserLog.password   := 'xxxxxx';
//   UserLog.authority     :='' ;
//   …
0
I have a main form and a frame. I have dynamically placed the frame on the form and set the parent of the frame to be the panel on the form.

When i try to free the frame via a button on the frame, using self.free, i get an access violation error thereafter.

I am a beginner programmer and i would like to know how to free the frame from memory without getting an access violation error.
0
hi everyone,

  here we have an  Delphi application, it's functionality is to receive data from Ethernet and  to store received data in database(Interbase DB) . to store or retrieve data in Interbase DB(Local DB) we are using BDE components. and here we are posting that data to Azure cloud using ADO components. when ever we deployed our application into client system it is working well for sometimes 3hr and sometimes 4hr and sometimes even 24 hr also it is working well but after that we are getting the above exception and exe getting hanged and forcibly stopped. I have searched about above exception all over the internet but didn't get an idea what to do. but crazy thing is this application has ran continuously for 4 days continuously whenever we tested it in my system.  I think it is something to do with BDE Components.
   
 forgive me if you are not able to understand my English.
Any suggestions or solutions are helpful.
0
I have many kind of components on the form and I need to change the captions:

    While not Eof Do
     Begin

       MyComponent := InputRek.InputForm.FindComponent(FieldByName('Name').AsString);

       If MyComponent<>nil Then
        Begin

          If MyComponent is TButton Then
           Begin
            ( MyComponent as TButton).Text := FieldByName('Value').AsString;
           End

          Else If MyComponent is TTabItem Then
           Begin
            ( MyComponent as TTabItem).Text := FieldByName('Value').AsString;
           End;

// and here a lot of others
        End;

       Next;
     End;

Is there any way to use only one row instead of many If-s?
E.g. MyComponent.Text  ... I know that this is not possible but maybe there is a common ancestor which has Text property...

Thank you
Delphi
0
I have a menu item with a ShortCut inside a popup menu. I need to detect whether this menu item has been either manually clicked (e.g. with the mouse) or with the shortcut. Is this possible?
0
i asked the question in many places and seems no know are really know how this can be solved

i a trying to apply a on gesture event to the Twebbrowser
 but it seems it does not work at all .

here is how i place the Twebbrowser

1 - i  added Tlayout
2 - i added inside the Tlayout a Tpanel
3- i added inside the tpanel a Twebbrowser

also i have set webbrowser.hittest To True , then i dropped a gesture manager to the form then i set the gesture manager to the Twebbrowser Touch property .

then on gesture manager i have added the following code

if EventInfo.GestureID = sgiLeft then
begin
 
showmessage('left moved');
 
 
Handled := true;
end;

Open in new window


sadly when i move my finger left or right it does not detect the gesture and never show the message that i set

why i cannot use gesture in twebbrowser ?
0
I'm binding a grid to a clientdataset, but once I do, everytime I try to run the application I get "Cannot change this property when using LiveBindings".
0
Hey everyone I have a problem with my query
Iwant to realise a query that at gives the maximum of the defects  in my database and displays the 3 top values in another table.

PS i developpe with delphi 7 and my database  with paradox 9.
help plz
0
Hi,

Some of my customers want to be able to mark the position on the human body where a person has pain and such.
Therefore I'm looking for a way to present some static images (from a whole body (front and back), or a part of it: like feet of hands).
To get a general idea you could visit: http://www.clinicjot.com/

Can anybody advise me on which Delphi components would be suitable for this? And how to get started?

Thanks.
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hello guys,

I create a simple dll and application that I only call a method and it display " hello world ".

Now I need to create a function where I can pass a string to it and do it display my message, take a look at my code:

Dll created

library DllCrystal;

uses
  SysUtils,
  Classes,
  Dialogs;

{$R *.res}

procedure DllMessage; export;
begin
  ShowMessage('Hello world from a Delphi DLL') ;
end;
 
 exports DllMessage;

begin
end.

Open in new window


My application that calls the DLL

unit Unit1;

interface

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

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

var
  Form1: TForm1;
  procedure DllMessage; external 'DllCrystal.dll';

implementation

{$R *.dfm}

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

end.

Open in new window



Now, I need a simple help from you how to do that, create a correct function and call the function in application passing the value to it.

thanks a lot
alex
0
I am writing a REST client application using Embarcadero C++ builder Xe10.1 Berlin.
I need to have the REST server IP address configurable.
I have initially set the TRESTClient component BaseURL property to a known server IP address in the IDE. The BaseURL property value is http://10.41.9.27:8080 and the application works just fine.
If I add code to change the BaseURL property however, the application doesn't respond and times out ?
Even if I use the value that works when set in the IDE, after the following code is run the application stops working ?

RESTClient1->BaseURL = u"http://10.41.9.27:8080";

Open in new window


Any ideas please ?
0
I don't what happen, but not working old good SetForeground() ..


      wnd := FindWindow(nil, 'World of Warcraft');
      if wnd <> 0 then
        begin
          Memo1.Clear;
          Memo1.Lines.Add('World of Warcraft is loaded with handle : '+ inttostr(wnd));
          Form1.SendToBack; // Working
          BringWindowToTop(wnd); // not working
          SetForegroundWindow(wnd); // not working

Open in new window


Advice me, what need change ...
0
I launch delphi app app1 from another Delphi application app2

How to debug app1?

Both running from same machine and I have source for both
0
I am a Delphi Developer and I want to use  and ActiveX component (for Compression) in my application. Will this make my program more vulnerable to Virus attacks ? My program is a backup application that uses FTP and Sockets to transfer files and messages. My program has nothing to do with a Internet browser.
0
Hi,
I have a problem with a 3d object (TCube).
All movement is correct if object is not rotated.
But when object is rotated, the moving axes not work correct, for example: when i drag to move the object movement was denaturated.

Please help
0
We need to create a bat file for our Delphi program (Windows environment) in order to help our personnel for avoiding manual operations and possible deleting some crucial files.
I  am trying  to explain you  it simply

We have a shared folder located on Z (map network drive) with name X , so
elegktes.pngThe folder contains a subfolder with name active
•      Every person who is assigned a task (e.g a car plate) is put into active folder.
•      Every person who is free (able to be assigned a job) is outside active folder

For example, We have for the active folder the following
We only use Greek characters for the name of the files.
If a car with plate KNK1234 is assigned to ABC person then the file is
ABC_ΚΝΚ1234.ini, where ABC is the full name of the employee

What we want is
a pilot menu so every time somebody clicks the bat file open a window which says
Which person you want to release? (I will translate all the text into Greek language)
It will display the name of the employees (We can modify it , so the program will read only the names which are inside the active directory)
I will provide the name of the employees (about 6-7 persons)
Do you want to release name of employee Yes or No
Release process (Every time the work on a car is completed, the worker is automatically released from the program.)
There are, however, sometimes for some reasons (repeating a process, etc.), which should be released through a process.

The full name of the person…
0
I am working on an application that has a toolbox (a small window that stays on top of, or even outside the main form).

There are three wishes to the visibility of this toolbox:
1) The user must be able to open and close (show and hide) the toolbox as s/he wishes. The toolbox can be opened AND closed via a menu item which uses the Checked flag to indicate the current state. The toolbox can also be closed via the X button of the toolbox itself.
2) When the user switches to a different application, the toolbox (if visible), must be hidden until the user switches back to the application in question. This is important because the user may have more instances of the application open and switching between them must also switch toolbox so that a visible toolbox is assured to be linked to the active application. The toolbox must only be shown again if it was visible before the application switch.
3) If the application is minimized, the toolbox (if visible), must be hidden until the application is restored. The toolbox must only be shown again if it was visible before the minimize.

Now, that's three wishes at the same time. Maybe I should have bought a Kinder Egg...

Opening and closing via a menu item is easy. I can simply ask for the current state of visibility, in order to determine whether to Show or to Hide. However, the nasty user can also close via the X button of the toolbox, so I cannot just set the menu item Checked property when processing the menu click. To …
0
Hello,

I use Delphi Seattle. I need to write an app for Android.
Please help me how to do the following task:

-the user makes photos with the phone
-in my app he needs to choose the photo(s)  (here it would be good that the directory of the camera would be the default)
-after choosing the photo(s) I need to copy it (them) to a NAS server folder.

On Windows this would be a 5 minutes task for me but I am a newbie with Android....

Thank you very much
0
What does it mean to be "Always On"?
LVL 4
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Hello,

I have and Android multiplatform program written in Delphi Seattle.
I process a query like this (simplified version):
       While not MyQuery.Eof Do
        Begin
            MyProcedure(MyQuery.FieldByName('Field1').AsString );      
            MyQuery.Next;
        End;

Open in new window

This worked well, it processed every record.

Then I changed it to this:

       While not MyQuery.Eof Do
        Begin
            MyProcedure(MyQuery.FieldByName('Field1').AsString );     
            MyQuery2.Sql.Text := 'Insert into ....';
            MyQuery2.Execute;
            MyQuery.Next;
        End;

Open in new window


After this, only the first record was processed! The same code in Vcl (Windows) works perfectly.

Then I tried with a thread:

       While not MyQuery.Eof Do
        Begin
            MyProcedure(MyQuery.FieldByName('Field1').AsString );     
           MyQuery2.Sql.Text := 'Insert into ....';

           T := TTask.Run (
           procedure
            begin
              MyQuery2.Execute;
            end);

            MyQuery.Next;
        End;

Open in new window


After this, it processed again all the records but the MyQuery2 insert actually didn't happen.

Then I tried "MyMemo.Lines.Add( 'xxx'); instead of MyQuery2 and again it processed the first record only:
       While not MyQuery.Eof Do
        Begin
            MyProcedure(MyQuery.FieldByName('Field1').AsString );      
            MyMemo.Lines.Add( 'xxx');
            MyQuery.Next;
        End;

Open in new window


What is weird for me that it seems to me that sometimes Android doesn't process the commands sequentially.
What can I do? Is there a "rule book" when Android decides when not to "take care" of my next command line?

Thank you very much.
0
I am using Embarcadero C++ builder XE10.1 Berlin in an FMX application. How do I set the background colour in a TEdit control ?
0
I have a C++ builder code snippet below which I wish to use to display the cell values in a FMX TGrid component
The code gets called but the cell content is not displayed.
I suspect that this may be due to the TFillTextFlags not being initialised ? how do I do this or otherwise get the code to work ?
Also, how would I set the colour of the text being displayed by the fillText function ?

Thanks,

Roger

void __fastcall TForm1::Grid1DrawColumnCell(TObject *Sender, TCanvas * const Canvas,
		  TColumn * const Column, const TRectF &Bounds, const int Row,
		  const TValue &Value, const TGridDrawStates State)
{
	TValue v = Value;
	UnicodeString u = v.AsString();
	TFillTextFlags flags;
	Fmx::Types::TTextAlign ATextAlign;

	Canvas->Clear(claWhite);
	Canvas->FillText(Bounds,u,false,1,flags,Fmx::Types::TTextAlign(0x0));
}

Open in new window

0
I have an XML file (see Attached file)  with a pdf file attached to it, which can be found at the following path

'Invoice/cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject'

I tried decoding the mimeCode (assuming this was decoded with base64?) and then tried to save it to a pdf file using a TStringStream... but it just gives me an empty pdf file.

ss := TStringStream.Create;
str := IdDecoderMIME1.DecodeString( str );
ss.WriteString( str );
ss.Position := 0;
ss.SaveToFile('C:\pdf.pdf');

Open in new window



How can I extract the pdf file from the xml and save it to a file?
XML-with-pdf-attached.xml
0
I currently have a program that downloads a file from my VPS and extracts it. I want to make it download straight from the original website but it doesn't want to work. I want to make it download this link: https://bintray.com/oxidemod/builds/download_file?file_path=Oxide-Rust.zip instead of this: http://41.185.91.51/RSM/Oxide-Rust.zip

I'm using Rad Studio 10.2

I did find this post but I'm struggling to add it to my current project: https://www.experts-exchange.com/questions/23286908/Downloaded-files-using-TIdHTTP-INDY-10.html

Here is my current project code:
unit uOxideModInstaller;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls,
  Vcl.StdCtrls, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdHTTP, System.Zip;

type

  TDownload = class;

  Tfrmoxidemodinstaller = class(TForm)
    lbl1: TLabel;
    pb1: TProgressBar;
    btn1: TButton;
    btn2: TButton;
    lblstatus: TLabel;
    procedure btn2Click(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TDownload = class(TThread)
  private
    httpclient: TIdHTTP;
    url: string;
    filename: string;
    maxprogressbar: integer;
    progressbarstatus: integer;
    procedure ExtractZip(ZipFile: string; ExtractPath: string);
    procedure idhttp1Work(ASender: TObject;

Open in new window

0
The result I wantI would like to make a graph with stacked bars in fact I have a table with Type,duree and Attente for each Type (F, M, P, ...) and I want to display them as a histogramm double i used ChartFX And TDBChart but I do not get the desired result please help me I m using Delphi 7 and i use this code to calculate Duree and Attente
DataModule1.Chart1.first;
   while not DataModule1.Chart1.EOF do
   begin
   DataModule1.Chart1.delete;
   end;
Req:= 'Select Type,Sum(Duree) as Duree,Sum(Attente1) as Attente1'
+' From "Ouvraison.DB"'
+' Group by Type'
+' Order by Type';
with DataModule1 do
begin
Query1.close;
Query1.SQL.Clear;
Query1.SQL.Add(Req);
Query1.Open;
Query1.first;
   while not Query1.eof do
   begin
   DataModule1.Chart1.Insert;
   DataModule1.Chart1.FieldByName('Type').value                             :=Query1.FieldByName('Type').value;
   DataModule1.Chart1.FieldByName('Duree').value                            :=Query1.FieldByName('Duree').value;
   DataModule1.Chart1.FieldByName('Attente').value                          :=Query1.FieldByName('Attente1').value;
   DataModule1.Chart1.post;
   Query1.next;
   end;
0

Delphi

59K

Solutions

16K

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.