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
Good Afternoon:

I have a code made in Delphi, in which, I see that a usb communication is established, of which, it is already done and I have no problems, but, my doubt is as follows:

  What is the function that is in the code, to be able to send a value in hexadecimal and in turn, have the answer in hexadecimal or capture the answer in hexadecimal. If possible, you can give me an example of sending and answering.


   I put the complete code so you can help me.

   thanks for your help

unit Unit1;
{************************************************* **************************************}
{*                    USB - Lectura / Escritura                                         *}
{*                                                                                      *}
{*                                                                                      *}
{*   Cómo se Usa:                                                                       *}
{*   Envío y lectura de datos al dispositivo:                                           *}
{*   string_result: = RWUSB ('DATOS PARA ENVIAR EN HEXADECIMAL', Read, Timeout);        *}
{*                                                                                      *}
{*   EJEMPLO (SOLO ENVÍO):                                                              *}
{*   s: = RWUSB ('FF FF FF');                                                           *}
{*                                                               

Open in new window

0
I use Delphi and want to send SMS via the COM Ports + Mobile phone combination.
I am using the AT+ commands but I get SMS which includes the commands. I want only the message to come.
Sample SMS

AT+CMGF=1AT
AT
AT
AT+CMGF=1

AT
+CMGS="nnnnnnnnnnn"

Open in new window

0
I am using below code successfully via VCL, but FMX does not recognise HBITMAP.
I want to use below code via FMX to resize Bitmaps.

procedure TForm9.ScaleBitmap(Source, Dest: TBitmap; OutWidth, OutHeight: integer);
var
  src, dst: TGPBitmap;
  g: TGPGraphics;
  h: HBITMAP;
begin
  src := TGPBitmap.Create(Source.Handle, 0);
  try
    dst := TGPBitmap.Create(OutWidth, OutHeight);
    try
      g := TGPGraphics.Create(dst);
      try
        g.SetInterpolationMode(InterpolationModeHighQuality);
        g.SetPixelOffsetMode(PixelOffsetModeHighQuality);
        g.SetSmoothingMode(SmoothingModeHighQuality);
        g.DrawImage(src, 0, 0, dst.GetWidth, dst.GetHeight);
      finally
        g.Free;
      end;
      dst.GetHBITMAP(0, h);
      Dest.Handle := h;
    finally
      dst.Free;
    end;
  finally
    src.Free;
  end;
end;

Open in new window

0
Hi,

Below part of some VB.Net code is shown. It is used to interface data to an online application via SOAP.
The full code can be downloaded here
First some info: Code from de WDSL:
    function CreateStamTabelRecord(const PartnerKey: string; const Omgevingscode: string; const SessionId: string; const Stamtabel: Stamtabel; var Primarykey: string; var Foutmelding: string): Boolean; stdcall;

Open in new window

  Stamtabel = class(TRemotable)
  private
    Fschema: TXMLData;
  public
    destructor Destroy; override;
  published
    property schema: TXMLData  Index (IS_REF) read Fschema write Fschema;
  end;

Open in new window


Can anybody translate the following VB-code to Delphi?
The content of ds_mutatie is important to be correct. How should this be created within Delphi?
Private Sub btnCreateNewDeb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateNewDeb.Click
        If String.IsNullOrEmpty(txtSessionId.Text) Then MsgBox("SessionId is leeg.") : Exit Sub

        Select Case combometh.SelectedItem
            Case "SOAP"
                Dim ws1 As New ws1.ws1
                Dim foutmelding As String = ""
                Dim ds_records As New DataSet

                Dim ds_mutatie As New DataSet
                Dim dt_selection As DataTable = ds_mutatie.Tables.Add : dt_selection.TableName = "METADATA"
                dt_selection.Columns.Add("TABLE", 

Open in new window

0
I have a base form and multiple other forms which are visually inherited from the base form.
There is a tdxbar component on the base form with 4 groups tdxnavbargroup.

I need one additional group in just one of the inherited form so should I add in the base form or just the inherited form?
0
Experts
What is best option in below scenario
I have two Delphi apps app1 and app2, they have their own data modules say dm1 and dm2 respectively.
Now I actually was running app2 from app1 hence there was no issue in accessing an query component placed in dm1 from a common frame being used by both apps.
Now I need to run app2 as standalone and it throws exception at a line where it sees the reference to query component of dm1.

So I have used ifdef conditional directives but is there any other solution?
0
I want to do just drawing on the image and save it with the image extensio
0
delphi de image üzerinde savepicturedialog ile resim kaydetme yapıyorum ve resmi kaydederken jpeg ten bmp ye çeviriyorum fakat dönüştürme yaparken dosya yoluna . jpeg kısmına dosyayı kaydederken yazılan ismin eklenmesi istiyorum nasıl yapabilirim.?
0
I have coded a Windows 32 VCL application using Embarcadero C++ builder  EX10.1 Berlin and using a winsoft TOBR barcode recognition component.
The application worked.
I now wish to no longer use the Winsoft component in the application so I removed it from the project entirely,including the library and the obr.hpp header file.
The project now compiles but I get a linker error that the file OBR.OBJ cannot be found when the project no loger uses the component as far as I can see.
Where is the linker getting the reference to OBR.OBJ from or how can I get rid of the error ?

The ilink32 command line is as follows :

  c:\program files (x86)\embarcadero\studio\18.0\bin\ilink32.exe -G8 -L.\Win32\Debug;"c:\program files (x86)\embarcadero\studio\18.0\lib\Win32\debug";
  CivicWeldRESTServer;"c:\program files (x86)\embarcadero\studio\18.0\lib\win32\release";"c:\program files 
  (x86)\embarcadero\studio\18.0\lib\win32\release\psdk";C:\Users\Public\Documents\Embarcadero\Studio\18.0\DCP -j.\Win32\Debug;"c:\program files 
  (x86)\embarcadero\studio\18.0\lib\Win32\debug";CivicWeldRESTServer;"c:\program files (x86)\embarcadero\studio\18.0\lib\win32\release";"c:\program 
  files (x86)\embarcadero\studio\18.0\lib\win32\release\psdk";C:\Users\Public\Documents\Embarcadero\Studio\18.0\DCP -l.\Win32\Debug -C -v 
  -GA"C:\Users\roger\AppData\Local\Temp\vfs7F41.tmp"="C:\Users\roger\Documents\Embarcadero\Studio\Projects\FrameStatusWebServerV2\WebModuleUnit1.dfm" 
  

Open in new window

0
I have to use unit shareMem for accessing dll-procedures with string-params. Now, when I execute the application on a computer without borlndmm.dll I get an error that this file is missing. How can I embed this (I thing with a runtime-package, but which one?)?

Delphi XE 10.1

Thanks, Peter
0
I am trying to read Thunderbird files such as Inbox in Delphi - to get the email addresses and to be able to parse the message contents and suchlike.

Is there a component or class that can do that publicly available? I believe Thunderbird stores the emails in the mbox format.
0
Hello,

Got some problems with cloning client datasets. Aggregate works after a cloning if the Aggregate active is first turned off and then back on, but if there is a Grouping level, no. It will stay blank. I checked the property of the index and of the aggregate field; both Grouping level's are still 1 after the clone and it works as is should until i clone...
0
I am getting a linker error when compiling an application with Embarcadero C++ Builder XE10.1 .
The application is a 32 bit windows VCL application (Web application). I can usually fix the error by re-booting the PC and running the compiler before any other application but recently this doesn't fix the problem.
The PC is a Dell precision 7710 with an Intel i7 2.7 Ghz processor and has 32 GB of RAM. the operating system is Windows 7 Professional 64 bit.
Looking around on the web, the issue would appear to be a buggy Embarcadero Linker which isn't going to be fixed any time soon.
Is there any solution to this ?

I have added the following option in the C++ Linker Additional options:   -GHtds=0x0F000000 and have also checked the  "clear state before linking" box in the C++ linker advanced options, neither of which actions has had any effect.

Any help appreciated.

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

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

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.