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

This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
0
how to save image in image object

if SavePictureDialog1.Execute then
Image1.Picture.SaveToFile(SavePictureDialog1.FileName);
this is not happening
0
sending Whatsapp messages programmatically in Delphi 2010?
0
 
LVL 101

Expert Comment

by:mlmcc
You asked this question in a POST rather than the Q&A area.
Not many expert follow these and since there are no points involved the tend not to answer questions.

Recommend you ask this through the ASK button or this link

https://www.experts-exchange.com/askQuestion.jsp

mlmcc
0
Hello guys,

I would like to trigger a function when I click on a label with ctrl key pressed. How to fire the trigger after doing that?

You can give me a simple example with showmessage('pressed!') after clicking on a label with ctrl pressed.

thanks
Alex
0
can udp server send data to a specific client that are on the same ip and port ?

i know that udp is connectionless but is there a way to send data to some clients based on some string matches ?

here is my client and server code


Server
unit UDPSRV;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent, IdUDPBase,
  IdUDPServer, IdGlobal, IdSocketHandle, Vcl.StdCtrls;

type
  Tudpservfrm = class(TForm)
    udpserver: TIdUDPServer;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Memo1: TMemo;
    procedure udpserverUDPRead(AThread: TIdUDPListenerThread;
      const AData: TIdBytes; ABinding: TIdSocketHandle);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    procedure UpdateBindings;
  public
    { Public declarations }
  end;

var
  udpservfrm: Tudpservfrm;

implementation

{$R *.dfm}

procedure Tudpservfrm.Button1Click(Sender: TObject);
begin
 UpdateBindings;

 udpserver.Active := true;
end;

procedure Tudpservfrm.udpserverUDPRead(AThread: TIdUDPListenerThread;
  const AData: TIdBytes; ABinding: TIdSocketHandle);
begin
//
//memo1.Lines.Add(bytestostring(AData) + ABinding.PeerIP + ' : ' + intTostr(ABinding.PeerPort));
Athread.Server.Send(ABinding.PeerIP, ABinding.PeerPort, bytestostring(AData));





end;

procedure Tudpservfrm.UpdateBindings;
var
Binding: TIdSocketHandle;

Open in new window

0
We plan to begin coding (Delphi 10.x) application for smartphone, in a first stage, accessing the customer database, the smartphone being connected to the customer local network.
It seems I have two alternatives : Direct access or REST/HTTPS layer.
Is there some documentation explaining advantages and disavantages of both methods ?
0
Hello,

Some program have stolen my alt-F12, according to some software its "system debugger" whatever that is. I need Alt-F12 for my delphi IDE. Looks hard to change hotkeys in Delphi and even harder to identify and get back a hotkey. Any suggestions?
0
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
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
On this form, there are (3) TDBGrids. OnCalcCellColors  or OnDrawDataCell, need to compare a value in grid1 with a corresponding value in grid3. The row color for all (3) grids will be determined by the comparison. >= Red, < Green etc...

The coloring is easy. However without ARow & ACol cell references, not sure how to index the values. Works great on a single grid.
Doing the comparison in this manner with negate the need to  Enumerate the data set.
0
I have an application that checks for files create by a Point of Sale application and then imports these files. It also compares the files and write to a settings file what the last time was it imported a file.

I have a problem where my application runs fine for a random amount of time (normally between 2-5days), then all of a sudden my application loses the ability to write to any file in Windows, even files created by my application and files that it was able to access just moments ago.

If you restart the application, everything works fine again for a random amount of time.

This happens on Windows 7/8/8.1/10/ server 2012

Code to write to the File:
function TFrmMain.CompareFileDate(sFileName : string): Boolean;
var
  dOldDate  : TDateTime;
  dNewDate  : TDateTime;
  ini       : TIniFile;
  iFileDate : Integer;
begin
  try
    //Get Old File Date
    ini := TIniFile.Create(IniFileName);
    try
      dOldDate := ini.ReadDateTime('Import','LastImportedFile',0);

      //Get File Date and Time
      iFileDate := FileAge(sFileName);
      dNewDate  := FileDateToDateTime(iFileDate);

      if dNewDate > dOldDate then begin
        Result := True;
        ini.WriteDateTime('Import','LastImportedFile',dNewDate);
      end else
        Result := False;
    finally
      FreeAndNil(ini);
    end;

  except
    on e : Exception do begin
      Result := True;
    end;
  end;
end;

Open in new window

0
I apologize for having to start another thread regarding this. But it's been over a week since the problem occurred. I have messaged a few members on here who are for hire but to no avail.

So the last time, my computer had a power outage while I was inserting data into a table on paradox. When I turn back on the computer and try to access the table it says the index was out of date. I believe it was because the something was written on the primary index and not the secondary which resulted in a header inconsistency. As suggested I downloaded some auto table rebuild/repair software; including the one that came with paradox (TUTILITY). After I rebuilt the index using TUILITY the problem was fixed, but another problem in another index occurred. This led me to doing a series of trial and error with the different software, and the outcome varied.

It seemed the more I messed with it,, little bits and pieces were being fixed, while I think perhaps I was making the problem more complex. And finally where I'm at now, most of the data is fine and I can work with, except one key component. My QTY-LEFT.DB shows some of the items with quantity left and the product order number, while a bunch of random ones are missing. I'm not sure if one of the software I used overwrote something. I deleted all my old files and index because I thought everything was fixed. It wasn't until I realized that this little bit was missing.

I've been working on it for eight hours straight today, but …
0
I have searched online and have been unable to find a recent example as to how the eBay API can be called from a recent version of Delphi XE using Indy.

If anyone can post here such a piece of code, I am sure it would save many people a lot of time trying to figure it out.

Many thanks!
0
Hi everybody,

I working to implement CD burning capabilty with IMAPI on D2007/XE/Berlin.
I don't want components or DLL.

I have try to write in Delphi this code:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364817(v=vs.85).aspx
with also the "Monitoring Progress With Events"
Has anyone already done it and can help me?
0
[Using Delphi] Hello Guys, i have a client/server unprotected application that cant be replaced and i dont have it sourcecode.
So i need to create a bridge between those applications like:
Client > ClientBridge > ServerBridge > Server
Why?
On ClientBridge i need encrypt the data sent from Client and on ClientServer i need decrypt those data and repass to server, server should answer so the process must be bidirectional.
I Could repass the data easily using Indy IdMappedTCPPort, however, i was wondering how to encrypt the data.
If i put any code on IdMappedTCPPort OnExecute() event the data is not repassed.
Keeping in mind that the "encrypt" could be of any type, the intention is to not allow the client comunicate directly with server without the bridge, and of course, protect the data.
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
after open file dialog how could i save this file to DB

openDialog := TOpenDialog.Create(self);
  openDialog.InitialDir := 'D:\';
 openDialog.Options := [ofFileMustExist];
//
//  // Allow only .dpr and .pas files to be selected
 openDialog.Filter :=
   'All files (*.*)|*.*';
//  // Display the open file dialog
 if openDialog.Execute  then
 title:=openDialog.FileName;
  TFileStream.Create (title, fmOpenRead);
  dbAttach_Title.Value:=title;
  //'File : '+openDialog.FileName;
//  else ShowMessage('Open file was cancelled');
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
I have this password-protected .mdb database. There is a table I need to copy into a different non-protected mdb database. I need to perform this task using Borland Delphi 7 ADO components. help?
0
Hey guys so I have a big problem. About 20 years ago my partner helped program a software for our business but he is no longer here with us. I have all my company information stored in this program. Yesterday suddenly my computer crashed while paradox was running. But I managed to boot it back up.

When I reopen PARADOX And try to access the directory this shows up

Cannot open LINEITEM.DB.
Index is out of date.
Table C:\GM2\LINEITEM.DB

Now I am completely computer illiterate and have tried to do my own research but it's like you guys are speaking in a different language. So it would really be appreciated if anyone can explain to me how I can fix this in more simple terms. I'm thinking reindex?
0
I have use other db components in delphi, but I am having a particular issue using firedac.
Using Delphi10 Seattle, Sql Server 2012.
I have a firedac table pointing to a dataset.
that dataset has 3 fields.


reg_id (integer)
id_css(varchar 8)
reg_value (varchar(250))

i have this table joined to another table using masterdetail, on the reg_ID
a particular record exists in the data set, and is shown in this query:

select * from dbregval where id_css = 'PSI99'
order by reg_id
(see pic1)
pic1.JPG
regID = 128000.
id_css = psi99
value string = '1'

in the program, I set the filter options to FOCaseInsensitve, foNoPartial
I have set this both at the component level and in code, before the table is opened.

when reg_id is 128006, a records is found (because id_CSS in db is PSI99)
(see file 128006.jpg)
128006.JPG
however, when reg_id is 128000, no record is returned in firedac
(dmCommon.tblUserReg.isEmpty is returning true)
(see file 128000.jpg)
128000.JPG
This is the sql as reported by firedac monitor, when I refresh the table:

SELECT A.*
FROM dbo.dbRegVal A
WHERE (A.reg_id = :reg_id) AND
(((A.reg_id = :FD__WN_reg_id) AND (A.id_css < :FD__WN_id_css)) OR ((A.reg_id < :FD__WN_reg_id))) AND
(id_css = 'PSI99')
ORDER BY A.reg_id DESC, A.id_css DESC

so, the question is : how do I use case insensitive filters, using firedac?
and why is this not working?  I'm new to firedac?
any idea what it is that I am …
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

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.