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 using Twsocket to running a few thousand Clients with it but after 40 Clients the server stopped from Listening i just do some database query and send back staff to the clients i dont use any Visual UI any idea what i am doing wrong ?



unit Mainserv;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdGlobal, Vcl.StdCtrls, Vcl.ExtCtrls,
  Vcl.Imaging.GIFImg, Vcl.Imaging.pngimage, JPEG, System.DateUtils,
  OverbyteIcsWndControl, OverbyteIcsWSocket, OverbyteIcsWSocketS;


const
  Sep = '~';

type
  TConnection = class(TWSocketClient)
  private
    procedure ISALIVE;






   public
    cName: String;
    cpassword : string;
    IP: String;
    Connected: TDateTime;
    Cuserid: string;
    CisLoggedin : string;
    CANENETR : string;
    status : integer;
    ForceDC : String;

    procedure broadcastleft(const usernameleft: string);
    procedure SendCommandWithParams(const Command: String);
    procedure HandleLogin;
    procedure broadcastjoin;
    procedure broadcastmsg(const msgtxt: String);
    procedure SendClientsList;






  end;


type
  TForm3 = class(TForm)
    Panel1: TPanel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    servertcp: TWSocketServer;
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure servertcpBgException(Sender: 

Open in new window

0
Cloud Class® Course: CompTIA Cloud+
LVL 12
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Hi guys
I am looking for a component or a method. to create a database application that uses the ribbon component with a client area as indicated on the image




these images are taken from an example of what I want to do
thank you all
0
I had this question after viewing Error EResNotFound when using custom component at runtime.

Sorry for errors in translation / concordance, I'm using google translator.

I have the same problem as the friend said in the link. The component has resource file, but when placing in the project it informs that the resource does not exist.
I saw the solution provided, however, I did not understand how to put it in my code.
0
how could i make Twsocket send strings in utf-8 encoding using sendstr ?
0
Hey there experts!
I have a importer app developed using delphi and oracle. What it does is, imports data into tables from excel files.
When i run the app it shows list of import files which come from table "importFile".
The structure of the table as below:

ImportCode          PackageName                TableName
A_21                       package_21                      tab_21
A_31                       package_31                      tab_31
A_41                       package_41                      tab_41
So actually when i run the app and select A_21 it runs the package_21 and inserts record into tab_21 similarly other import files.

I have records in tab_21, tab_31 and tab_41 which store the import information.

Now the suffix in importcode, packagename, tablename needs to be changed which means A_21 can become A_31, A_31 may become A_41 and so on.
For example now when i run the app create a new import file A_21 will become A_31, package name will become package_31 and table will become tab_31. The problem is i need to get the old records from tab_21 to tab_31.

So the logic is :
if A_21 changes to A_31, it will check if tab_21 has records or not, if there are records it needs to be copied to A_31. But A_31 may have existing records so those can be transferred to a temp table.

Now if A_31 needs to be changed to A_41, the records which is stored in temp needs to be copied A_41.

So precisely i need to suffle the table names with preserving the old …
0
Hi
following situation:
DelphiXE 10.1
own package. I compile the package with platform win32 in a folder bpl32 and same with platform win64 in folder bpl64. When I want to add the win64-package in the ide I get the message "can not be loaded %1 is no valid win32-application". How can I load 64-bit-packages.

If I load Win32-cpmpiled package I can compile my application with platform win64. But what about the functions used in that package? Are they 32-bit even if I compile with 63-bit?

Thanks for your answers.

Peter
0
I am trying to debug a custom component by using delphi to do it.

using : Delphi Tokyo 10.2.2, Windows 7.



this is my component source:

unit pvDBLookupCombo;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, System.UITypes,
  RTLConsts,
  cxControls, cxContainer,
  cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, strUtils, variants
  , Data.DB;

type

  TProVDBLookupEditProperties = class(TcxLookupComboBoxProperties)
  private
       fSearchSQL : tStringList;
  public
    constructor Create(AOwner: TPersistent); override;
  published
     property ClearKey default 27;
     property GridMode default true;
     property ImmediatePost default True;
     property ValidationOptions default [evoRaiseException, evoShowErrorIcon];
    property SQL : tStringList read fSearchSQL write fSearchSQL;
  end;

  TProVDBLookupComboBox = class(TcxDBLookupComboBox)
  private
    { Private declarations }
//     FSearchKind: TSearchKind;
     fIsRequired : boolean;
     fSearchDataSource : tDataSource;

  protected
    { Protected declarations }
//    procedure DoOnNewLookupDisplayText(const AText: string);override;
  public
    { Public declarations }
      constructor Create(AOwner: TComponent); override;
      class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
  published
    { Published declarations }
    //property searchKind : tSearchKind read fSearchKind write fSearchKind;
    

Open in new window

0
Hello, (I'm using delphi 7 and paradox 9) , i'm coping data from table paradox to text file and i m using Timer (interval=30 minute) ,this table is updated every 30 minutes by another user which causes sometimes a blockage to the table paradox and if i close the application the blockage will be removed any solutions please .
0
Hi,

I want to add optional two-factor authentication during login into my Delphi win32 application.
Using: Delphi 10.1 Berlin Enterprise
User logs in using normal username and password. On his mobile phone he receives an authorisationcode which he needs to enter in the application.

What would be the easiest way to set this up?
A very basic example would be appreciated.
0
I have used TDBGrid and its related components which helps to populate data in Dbgrid. I have selected multiple (Three) row data record form Dbgrid and trying to populate these selected record on Quick report with separate pages along with respectively title.  I tried to achieve this functionality but unable to do same as my requirement. Please give me any suggestion or   solution to achieving all DBgrid selected data to populate with separate pages along with title on Quick report.

for additional information is, I am using Delphi 7 and  Quick report.

Please let me know in case of any query.

Regards
Manoj Yadav
0
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Hello Guys,

How can I load a XML file ( the contents) into a field in my MSSQL table?

I only want the texts that inside the file and not the binary file

My field in my table is a text field.

thanks
Alex
0
Hello Community,

I'm absolutely new on programming and I want to learn Delphi as my main and solid first choice.
Searching on Google I did not find any interesting resource about how can I start programming on Delphi (or not just with updated content). I want to know about learning sites, learning video courses, ebooks and all of them completely easy to follow and readable.

Please, I hope that someone can help me with my request.
Also, Are there any free version of Delphi to start programming with?. And the result of the created apps with this IDE can be used for business?.

Regards,
0
Unsure what to ask :), but Record data being passed from script to plugin is incorrect

When the label1.caption is supposed to show MyInt instead is shows "71850800" no matter what

Script:
uses sysutils, classes;

type
  TMainSet = Record
    MyInt : Integer;
  end;
  PMainSet = ^TMainSet;

var
  MainSet : PMainSet;

function StrToBool(s:string):boolean;
begin
  if s = 'True' then result:= true else result:= false;
end;

function PluginProc(Code: Cardinal; p1, p2, p3: WideString): WideString; stdcall;
begin
  case code of
    0: result:= script.path;
  end;  
end;

procedure StartPlugins;
begin
  Script.StartPlugin(script.path+'Project1.dll', @MainSet, false{ìîäàëüíî});
end;

procedure This();
var
  ii:integer;
begin
  New(MainSet);
  while delay(2000) do begin
    ii := Random(9999);
    print(ii);
    MainSet^.MyInt := ii;
  end;
end;

begin
  Script.MainProc(@StartPlugins);
  script.newthread(@This);
  Delay(-1);
end.

Open in new window


Plugin:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

const
  WM_PluginShow = WM_USER + 5402;

type
  Tplugin = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ShowPugin(var Msg: TMessage); message 

Open in new window

0
I am working for a company now for a couple of weeks. The build process is done mostly manually and takes several hours spread over several days. The languages in use are C#, COBOL, Delphi, Visual Basic 6, and of course the database with T-SQL. For the version control, we use Apache Subversion (SVN), except for COBOL code and the documentation, which is kept in Microsoft Visual SourceSafe (VSS). I have the idea to improve the process using a continuous delivery tool. Do you think that Jenkins would do the job?

Thank you for your reply.
0
in Implementing Web Application Proxy in Windows Server 2012 ,can i publish exes and little bit internal Software's like ( notepad,excel,adobe reader..our internal delphi related exes).
0
Hi Experts,
I have an issue in column sorting in a grid which is a dev express grid ( tcxgrid).

So in the column if i have records eg ABCDE, A ABCDE, AB ABCDE etc then it should sort as A ABCDE, AB ABCDE, ABCDE.

Is there any way to do this?
0
I created a TextEditor in C#, Now i want to load a file in the text editor through delphi so i used  shell execute function to achieve this but When i execute this it is opening the text editor without opening the file. My code is,
ShellExecute(0, 'open', PChar('C:\Users\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe'),PChar('C:\Users\Desktop\215_1.rtf') , nil, SW_SHOWNORMAL);
and also when i try to load a file in Notepad (by changing the path), it is opening the file but not in my text editor  
Whats wrong in it?
0
I wrote a web service in delphi (10.2.3), when I try to import the wsdl generated by the service with wsimport I get some errors like:

  [ERROR] undefined simple or complex type 'soapenc:Array' 

Open in new window


 How can I avoid these errors?

Attached the wsdl file of the service
 wszeus.wsdl.txt
0
Is there a clean way to determine whether a particular file is locked in Windows?
Before updating my program I want to be sure no files in the installation folder are in use. This to prevent the update from failing.

I tried the following code:

function IsFileInUse(FileName: TFileName): Boolean;
var
  HFileRes: HFILE;
begin
  Result := False;
  if not FileExists(FileName) then Exit;
  HFileRes := CreateFile(PChar(FileName),
                         GENERIC_READ or GENERIC_WRITE,
                         0,
                         nil,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         0);
  Result := (HFileRes = INVALID_HANDLE_VALUE);
  if not Result then
    CloseHandle(HFileRes);
end;

Open in new window


and this one:

    Result := False;
    try
      fHandle := FileOpen(inFile, fmExclusive);

      if fHandle = -1 then
        result := True
      else
        FileClose(fHandle);
    except
      Result := True;
    end;

Open in new window


and this one ...

     
      try
        if FileExists( inFile ) then
        begin
          try
            fs := TFileStream.Create( inFile, fmOpenReadWrite or fmShareExclusive );
            Result := False;
          finally
            fs.Free;
          end;
        end;
      except
        Result := True;
      end;

Open in new window



But all three have the same problem: By testing whether the file is locked, it is  (sometimes) locked by the test itself.
Is there a better way to check whether a file is locked, or will every solution result in the same problems?
0
Cloud Class® Course: Microsoft Windows 7 Basic
LVL 12
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

I'm trying to read an xml response from a api but I keep getting the following error:


How can I read the xml data if the response looks like this:
<status>success</status><statusmsg>online</statusmsg><vmstat>online</vmstat><hostname>quantum.vps</hostname><ipaddress>xxx.xx.xx.xxx</ipaddress>

Open in new window


My current code:
procedure TfrmMain.btn1Click(Sender: TObject);
var
  httpclient: TIdHTTP;
  doc: TXMLDocument;
  data: IXMLNode;
begin
  httpclient := TIdHTTP.Create(nil);
  try
    doc := TXMLDocument.Create(nil);
    try
      doc.XML.Text := httpclient.Get('https://site.com/api.php?action=status'); //Modified URL for experts exchange
      doc.Active := True;
      data := doc.DocumentElement;
      lbl1.Text := data.ChildNodes['status'].Text;
    finally
      doc.Free;
    end;
  finally
    httpclient.Free;
  end;
end;

Open in new window

0
I want to execute a external application eg. anotherapp.exe or start.bat. After starting that application I want to check it's resource usage every x amount of seconds.
  1. Execute a app
  2. Retrieve it's resource usage every x amount of seconds

I mainly want to use this to execute x amount of .bat files so using the app caption to get the resource usage is not really an option.
0
In Delphi 10.2 Tokyo:

I created a package called TestFrameCompPkg that has a frame TTFrameComp as a component. The package build and install work as expected.

My problem occurs at design time with the ShowEdit and ShowLabel properties. When I place the component on the form, the property changes don't Hide and Show the ToolBar components in the IDE. But each does function normally at run time.

How do I get the show/hide properties to function at design time?


Code Example is below:

FrameComp.dfm
object TFramComp: TTFramComp
  Left = 0
  Top = 0
  Width = 800
  Height = 291
  TabOrder = 0
  object ToolBar1: TToolBar
    Left = 0
    Top = 0
    Width = 800
    Height = 29
    Caption = 'ToolBar1'
    TabOrder = 0
    ExplicitLeft = 192
    ExplicitTop = 48
    ExplicitWidth = 150
    object Edit1: TEdit
      Left = 0
      Top = 0
      Width = 121
      Height = 22
      TabOrder = 0
      Text = 'Edit1'
    end
    object Label1: TLabel
      Left = 121
      Top = 0
      Width = 31
      Height = 22
      Caption = 'Label1'
    end
  end
end

Open in new window


FrameComp.dfm
unit FrameComp;
interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
  Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
  Vcl.ComCtrls, Vcl.ToolWin;
type
  TTFramComp = class(TFrame)
    ToolBar1: TToolBar;
    Edit1: TEdit;
    Label1: TLabel;
  private
    function GetShowEdit: boolean;
    

Open in new window

0
In Delphi I'm looking for a way to clone a two forms (one that has an ancestor that inherits components and settings accordingly) into a new single form that has no ancestor requirement.

To try and describe this - let's say that I have two forms:

FORMANCESTOR contains 3 buttons on it sitting on a Panel. The captions on these buttons are set in FormAncestor, and Buttons are called BTN1, BTN2 and BTN3.

FORMCHILD is a descendant of FormAncestor so the panel with the 3 buttons inherits automatically and shows on FORMCHILD.  But FORMCHILD has BTN3's caption altered, and has a new 4th Button added to FORMCHILD.

What I would like to do is create a new form called FORMINDEPENDENT which has the 4 buttons and Panel, and inherits from TForm as opposed to TFormAncestor

I was just wondering if there is a standard way / correct method to merge / migrate / clone from decedents as per the above so that I have a new independent form that doesn't need to reference any ancestors and can just be a descendent directly from a TForm?

Thanks

Adam
0
I had this question after viewing TAdvStringGrid:  Cell's Background and Font color handling.

In a TAdvStringGrid, in grid.OnGetCellColor event-handler, I've set each cell of the fixed column to a different color:

ABrush.Color := GetMyCustomColor;

Open in new window


Now, when I click on a cell of this fixed column, in the grid.OnClickCell event-handler, I want to get the color of the clicked cell.

How can I do this?

I have tried:

grid.GetCellProperties(ACol, ARow).BrushColor)

Open in new window


But it does not work. I always get the same color: RGB(255, 255, 255).
0
I have quite normal parameter like:

Procedure Something(var test:integer);

In the form i have a global variabel (well global to that form) defied as:

  public
    { Public declarations }
   var gtest :integer;


Now i want to transfer the pointer from test to gtest.

gtest :=test; wont work. How should it be done?
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.