[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

I am writing a windows Web application using embarcadero XE10.2 Berlin C++ builder;
The application uses a TWebModule and receives a POST web action from a web page being displayed on a remote mobile device.
the mobile device posts a jpeg image which Is received in the following function, st2 is a TMemoryStream.
I am copying the raw content into a TByteDyneArray b so that I can easily inspect it. I load the TMemoryStream with the raw content and then save the memory stream to a file with the extension .jpg.
This file is reported as corrupt or invalid or too long when I try to open it with windows Photo viewer or the like.
how do I extract the image data ?
The size of the raw data as given by  Request->RawContent.Length is
Inspection of the beginning of the raw content  up to encountering a NULL is shown in quotes below.
"------WebKitFormBoundary9lWvgPDQcTZoDcRf\r\nContent-Disposition: form-data; name=\"picture\"; filename=\"15123250544981385201258.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n�￘�£\x02tExif"

void TWebModule1::Action3Post(TWebRequest *Request,TWebResponse *Response)
{
	UnicodeString u,v,uu="";
	TByteDynArray b;
	char buff='a';

	int n,m,w;
	u = Request->ContentType;
	n = Request->RawContent.Length;
	m = Request->Files->Count;
	b = Request->RawContent;
	st2->Clear();
	b.set_length(n);
	st2->WriteData(Request->RawContent,Request->RawContent.Length);
    st2->Position = soBeginning;

//	Form1->Memo1->Lines =  Request->ContentFields;
	for(;;)
	{
		

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE
LVL 5
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

how do i draw an image inside a column ? as example inside coulmn 2 ?
0
Hello
Can you help me please!!! i have this message when i run my project
"Débordement de pile".
Thanks
0
Hello Guys,

Using indy when I try to post my code json to the serve, I got the follwing message:

415 UNSUPPORTED MEDIA TYPE

Where is the problem? The way that Json was created? Any declaration that I forgot?

I appreciate a lot any help on this


procedure TForm1.Button3Click(Sender: TObject);
var
  PostData: TStringList;
  JsonStreamRetorno, JsonStreamEnvio: TStringStream;
  rta, json: string;
begin

  JsonStreamRetorno := TStringStream.Create('');
  JsonStreamEnvio   := TStringStream.Create('{"nome": "AlexandreTeste",' +
                                            '"amb_uuid": "c75831f0-4561-4de8-b722-dd82f06f7a01",' +
                                            '"email_admin": "Alexandregarcia@khan.com.br"}');

  IdHTTP1.Request.Clear;
  IdHTTP1.Request.CustomHeaders.Add('Authorization:ace49f940a034ea4a35c8157d4620c3a');
  idHttp1.Response.ContentType := 'application/json';
  idHttp1.Response.CharSet := 'UTF-8';

  try
     IdHTTP1.Post( 'https://khanhomolog.skyinone.net/v2/api/clients/' , JsonStreamEnvio, JsonStreamRetorno);
   finally
    PostData.Free;
  end;

  Memo1.Lines.add( JsonStreamRetorno.DataString )

end;

Open in new window


Alex
0
Hello guys

I developed a procedure where I could get the result from my idhttp,

but it doesn't even work with this simple line:

https://khanhomolog.skyinone.net/v2/api/users/

that should return me:

{"detail":"As credenciais de autenticação não foram fornecidas."}

what is wrong in my code?

procedureTForm1.RetornoHttpGet2(): String;

var
  S: TStringList;
  M: TStream;
begin
 S := TStringList.Create;
 M := TMemoryStream.Create;
 try
   S.Values['token']     := 'ace49f940a034ea4a35c8157d462744a';
   S.Values['nome']      := 'fabio';
   S.Values['sobrenome'] := 'marq';
   S.Values['email']     := 'meuemail.gg@ksac.com.br';
   S.Values['ativo']     := 'True';
   S.Values['username']  := 'denis';
   S.Values['password']  := '190679';
   S.Values['cli_uuid']  := 'xxxxxxxxxxxxxx';


    IdHTTP1.Request.Accept         := 'text/html, */*';
    IdHTTP1.Request.UserAgent      := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0';
    IdHTTP1.Request.ContentType    := 'application/x-www-form-urlencoded';
    IdHTTP1.Request.AcceptCharSet  := 'ISO-8859-1,utf-8;q=0.7,*;q=0.7';
    IdHTTP1.Request.AcceptLanguage := 'pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4';
    IdHTTP1.HandleRedirects        := True;

   IdHTTP1.Post('https://khanhomolog.skyinone.net/v2/api/users/', S, M);
   Memo1.Lines.Add(Format('Response Code: %d', [IdHTTP1.ResponseCode]));
   Memo1.Lines.Add(Format('Response Text: %s', [IdHTTP1.ResponseText]));

   M.Position := 0;
   

Open in new window

0
I don't succeed  to connect mySql database from within my WebSite to  FDConnection component. Though I set all necessary fields given by the "info" button (in the  "Control Panel")  of my hosting server.  
it seems the hosting name given "mysql1051.servage.net" is not accepted by the component!
Please Help
0
Hi
i'm developping a project with delphi 7 and  I need to copy some fields from one table in paradox 9 to another table in paradox 9 .
Somebody help me please .
0
Hello, I'm a Windows software developer (Delphi language) and I'm trying to install one of my programs on a client's newly rented machine running Windows Server 2016 64-bit (this OS is uncharted territory for me).  Even though my program is developed in 32-bit, it runs on pretty much any other Windows OS and also 64-bit systems. Tried and tested. When I try to install it on this particular system though, I get a big blue window with the message:

"This app can't run on your PC"

(see attached screenshot), see additional screenshot for specs of machine).

Could it be some heavy duty anti-virus scanner running on that machine rejecting my software? Any thoughts please?

Thanks
    Shawn
ee-1.jpg
ee-2.jpg
0
Hi

I looking for a TEdit with gradient color.  How to change a TCustomEdit for this?

thanks
0
I am a total novice regarding Delphi. I am trying to build a package for eventual use in a C++ builder project (in which language I am not a novice).
I am using code that I have found for using Smart cards.
the following code fragment generates an error and I need assistance to understand why and correct it.
I am using Embarcadero RAD Studio 10.2 enterprise edition

var
  r : string;
  a : integer;
begin
  a := 1;
  while a <= Length(Input) do
    begin
    case Input[a] of
      #010       : if WantFormats then r := r + #10 else r := r + ' ';
      #013       : if WantFormats then r := r + #13 else r := r + ' ';
      #027       : if a < Length(Input) then
                     begin
                     Inc(a);
                     r := r + Extended[Ord(Input[a])+1];
                     end else r := r + ' ';
      #128..#255 : ; {<<<<<<<<< This line gerates the error }
      else r := r + Ascii[Ord(Input[a])+1];
      end;
    Inc(a);
    end;
Result := r;
end;


gives the following error message
[dcc32 Error] GsmHelper.pas(551): E2011 Low bound exceeds high bound

Open in new window

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!

Hi,

I'm trying to create subfolder in the TaskScheduler (using Delphi) and create schedules for my application inside the subfolder.
For TaskScheduler-access I use this EE-example.

To create a subfolder I found method TaskFolder.CreateFolder('\MyFolder', ?sddl?);.
Here sddl (=security descriptor associated with the folder) must be set, but I have no idea how to set it correctly.

So as a workaround I tried to create the folder "MyFolder" directly into folder "C:\Windows\System32\tasks\".
The folder is actually created by my application, but the folder is not visible inside Windows TaskScheduler.

procedure TForm1.Button1Click(Sender: TObject);
var ts : TTaskScheduler;
    tf: ITaskFolder;
begin
  CoInitialize(nil);                    // uses ActiveX
  ts := TTaskScheduler.Create(Self);
  try
    ts.AutoConnect := True;
    ts.Connect1(GetNetComputerName);
    if ts.Connected then
    begin

      // ts.GetFolder('\MyFolder', ?sddl? );   << THIS DOESN'T WORK
      // As a workaround I create the folder myself.
      // System32 is changed into SysNative, as otherwise the folder would be created in SysWOW64.
      ForceDirectories('C:\Windows\SysNative\tasks\MyFolder\');

      if DirectoryExists('C:\Windows\SysNative\tasks\MyFolder\') then
        tf := ts.GetFolder('\MyFolder')   // << THIS GIVES AN UNKNOWN ERROR
      else
        tf := ts.GetFolder('\');

Open in new window

How can I create a subfolder for taskscheduler in order to add my application's schedules inside that subfolder?
0
I have a website that runs xenforo forum software. I basically have a donations user group and those users have the ability to download some software. I want to add a login form to my application that checks if that user is in that group and if he / she is then it will open the main form. I want to know how I can make such a login form?
0
Hello guys

I have a maskedit where I inform ddd hh:mm:ss and I want to inc my date, I tried this code and it works fine for days but not
for hours :(

For example:  001  02:35:40 add to my date 07/11/2017 13:00:00

procedure TFDatasPrevisao.MaskEdit1Exit(Sender: TObject);
var
  dias, horas, minutos, segundos : String;
  Dt   : TDateTime;
begin
  Dt       := MaskEdit1.DateTime;
  Dias     := Copy(MaskEdit3.text, 1,3);
  Horas    := Copy(MaskEdit3.text, 5, 2);
  Minutos  := Copy(MaskEdit3.text, 8, 2);
  segundos := Copy(MaskEdit3.text, 11, 2);

  if StrToInt( dias ) > 0 then
  Begin
    dt := IncDay(dt, StrToInt( dias ))
  End;

  if StrToInt( horas ) > 0 then begin
     dt := IncHour(dt, StrToInt( horas ))
  end;

  if StrToInt( minutos ) > 0 then begin
     dt := IncMinute(dt, StrToInt( minutos ));
  end;

  MaskEdit2.Date :=  dt;

end;

Open in new window


Whats is wrong? any clue for a better way?

thanks
Alexandre
0
How Can I Read Cyrillic text from Old DBF file. Get the code page on the text.Encoding to Unicode then
write into DBF file with the same code page as the original ?

Thanks in advance.
0
Hello Guys

I have two variable in this format:  dd/mm/yyyy hh:mm:ss

StartDate = '01/11/2017 13:00:00'  
EndDate  = '02/11/2017  13:30:00'

How to get the difference between these two dates in days and hours

ddd  hh:mm:ss
001   01:30:00

Thanks
Alex
0
Hello guys,

I want to invest some time to study a new language for developing application for mobile (cell phone).

Nowaday I work with Delphi and I know that some last version of it, it is possible to build application for mobile,

but I am not sure if it worths it.

What should be the better language to start it? Java, Delphi, Visual Studio?

I'd like an opinion from you.

Thanks a lot
Alexandre
0
Hello,

I use Delphi Seattle.
If I use VCL forms application I often use Copy / Paste to duplicate objects.
E.g. I put a grid on the form, set a lot of properties then I paste it on another form to save time.

However, I cannot do this with Multi Device form. When I press Ctrl+C on any object I get Access violation at address... message.

Is there a way to fix this? Thank you.
0
type
  TNodeFunction = function(AInput: String): String;

implementation

function Func1(AInput: String): String;
begin
   result := AInput;
end;

Open in new window

Then I can do this:
var
  SomeFunc,: TNodeFunction;
begin
     SomeFunc = Func1;
    ....
So far it is good.

But my problem is that a certain place I need to detect in my program that I gave value to SomeFunc or not.

I tried this :
If SomeFunc<> nil Then <- but I get this error [dcc32 Error]  E2008 Incompatible types

Thank you very much for your help!
0
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
Free Tool: ZipGrep
LVL 11
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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
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

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.