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

var TimeTableArray : Array [1..28,1..288] of String;

Procedure InitialiseTimeTable;
Var i , j : integer;
Begin
for i := 1 to 28 do
    Begin
    for j := 1 to 288 do
        Begin
        TimeTableArray[i,j] := ' ';
        End;
    End;
End;

Procedure WriteTimeTableDataToFile;
var tdata : textfile;
    i, j : integer;
Begin
for i := 1 to 28 do
    begin
    assignfile(tdata, UserPath + inttostr(i) +'.txt');
    rewrite(tdata);
        for j := 1 to 288 do           //This loop causes the error
            Begin                            //I/O error 105
            writeln(TimeTableArray[i,j]);
            End;
    closefile(tdata);
    end;
End;

It works fine if the loop above only writes ' '
0
Hello,

In Delphi VCL if I use this code:

MyProcedure1;
MyProcedure2;
MyProcedure3;

... then it will execute one after another: first MyProcedure1 then MyProcedure2  etc.


However if I use FMX application, all 3 procedures execute at once.
How can I modify it so as it would behave just like in VCL?

Thank you very much!
0
Hello,
I want to select data from table paradox from (Date1,Time1) to (Date2,Time2) for example from 01/02/2018 time:22:00:00 to 14/02/2018 time 09:00:00 i'm using delphi 7
0
I have a dll written in Delphi that I need to call from a c++ program. My dll works when called from Delphi, both when using static and dynamic loading. However, in c++, LoadLibrary returns a null pointer. In both cases, test.dll is located in the same dir as the test program. I am a c++ beginner - any help is appreciated.

The dll:
library test;

uses
  System.SysUtils,
  System.Classes;

{$R *.res}
 function AddIntegers(_a, _b: integer): integer; stdcall;
begin
  Result := _a + _b;
end;

exports
  AddIntegers;

begin
end.

Open in new window


The Delphi test program - this return the line "3 + 4 is 7", as expected:
program SimpleDLLTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, Winapi.Windows;

type
  TAddIntegersFunc = function (_a, _b: integer): integer; stdcall;
var
  DllHandle : HMODULE;
  AddIntegersFunc : TAddIntegersFunc;
  TestInt         : integer;
begin
  try
    DllHandle := LoadLibrary(pWideChar('test.dll'));
    if DllHandle = 0 then begin
      Writeln('Error loading dll');
    end else begin
      @AddIntegersFunc := GetProcAddress(DllHandle, 'AddIntegers');
      if assigned(AddIntegersFunc) then begin
        TestInt := AddIntegersFunc(3,4);
        Writeln('3 + 4 is ' + IntToStr(TestInt));
      end else begin
        Writeln('Function not found');
      end;
    end;
    Write('Press Enter'); ReadLn;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Open in new window


The c++ test program:
#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
	HINSTANCE hGetProcIDDLL = LoadLibrary("test.dll");

	if (!hGetProcIDDLL)
	{
		cout<<"Could not load library!\n";
		cin.get();
	}
	else
	{
		cout<<"Library loaded!\n";
		cin.get();
	}

	return 0;
}

Open in new window


I did not write any function call in c++, since I have not yet even managed to load the library - I just get "Could not load library".
0
Hi,
I want to find, extract, and replace string on a file.

procedure TForm5.Button4Click(Sender: TObject);
var
  Stream: TFileStream;
  MS: TMemoryStream;
  Buffer: array [0 .. 1023] of AnsiChar;
  i: Integer;
  myKeyword : string;
begin
  Stream := TFileStream.Create(edtTarget.Text, fmOpenRead);
  try
    while Stream.Position < Stream.Size do
    begin
      Stream.Read(Buffer, 1024);
      m1.Lines.Add(Buffer); // no need, just display to evaluate
      (* 1. Get address of given keyword *)
      // i := Stream.PositionOf(myKeyword);   < how to do this?
      (* 2. Stream Replace *)
      // I want to replace MyKeyword with other string
    end;

    MS := TMemoryStream.Create;
    try
      MS.LoadFromStream(Stream);
      MS.SaveToFile(edtTarget.Text + '.mod');
      // save the edited file, is there any other way than using MS?
    finally
      MS.Free;
    end;

  finally
    Stream.Free;
  end;

end;

Open in new window


  1. I want to have the position of  "mykeyword" on my loaded file.
  2. I want to replace / delete "mykeyword" on my loaded file.
  3. I want to extract "mykeyword" + 1000 or some length.

my loaded file is up to 500 MB.
0
Hi Experts,
I have two delphi apps say app1 and app2,  both are exes.
I run one app2 from app1 by shellexecute command.
How can i pass a function of app1 inside shellexecute command so the function result is available to app2.
0
Hello! I'm using D2010. When I used FidFirst / FindNext to search folders and/or files, I was able to access the TSearchRec info easily. However, when I use TDirectory.GetFileSystemEntries and TDirectory.GetDirectories (I reckon these calls are simpler and faster!) I only receive the folders and files names. My question is if I can have access to the complete record (FileSize, FileDateTime, FileAttributes...) using TDirectory, and how. Thanks in advance
0
How can i know if an is running via a hosted environment say citrix server?

So i can run a delphi app in local machine or via citrix server. When running through citrix server the application should run straight away and while running from the local machine it should ask for login credentials.

How to do this, any clue please?
0
I'm working with Delphi 7 and I'm trying to minimize the hole application when the user minimizes any modal form and restore to the previous state when he/she clicks again on the app icon on the task bar. The first part I did it using this:

procedure TMyCustomForm.WMSize(var Msg: TMessage);
  begin
    if (Msg.WParam = SIZE_MINIMIZED) then
      begin
        // revert back to normal size
        WindowState:= wsNormal;

        // minimize application
        Application.Minimize
      end;
  end;

But the second part, when the user clicks over the icon on the task bar for restoring the application, the main form restores but the modal form stays minimized on the task bar until the users clicks it.

How can I do that? How can I capture the application event when the users clicks the icon on the task bar for restoring it?

Thanks.
0
Hi.
I am a novice Delphi programmer as you can see.
I just want to click a button in my Delphi program and write a specific number or string into a specific cell in Excel.

For example I want to write '1234' into excel 2016 worksheet  named 'my data', cell  r5 c2.
The excel file will already be open on the desktop and there is no need to close it after the write update.

I will appreciate your assistance.
0
I had this question after viewing Pascal Helo.

i had this script
unit hospital;
interface

implementation
uses crt;
Var
name:string;
typeofroom,tp,tv,nory1,nory2:char;
month, day, year, daysstayed,roomcharge,tpcharge,tvcharge,totalcharge:integer;

const
pc=125;
sc=95;
Wc=75;
Tvc=3.50;
Tpc=1.75;
begin
//prompting
writeln('please enter the patients''s name':44);
readln(name);
writeln('please enter the number of days stayed in the hospital':63);
readln(daysstayed);
writeln('please write the month':31);
readln(month);
writeln('please write the day':29);
readln(day);
writeln('pelase enter the year':30);
readln(year);
writeln('please enter y or n for which typeofroom you used. P for private, S for semi private, and W for ward':57);
readln(typeofroom);
Case typeofroom of 'P':roomcharge:=(pc*daysstayed);
                   's':roomcharge:=(sc*daysstayed);
                   'w':roomcharge:=(wc*daysstayed);
end;
writeln('enter y or n for yes or no if they used the telephone':62);
readln(nory1);
Case nory1 of 'Y':tpcharge:=(tpc*daysstayed);
                 'N':tpcharge:=0;
end;

writeln('enter y or n for yes or no if they used the television':63);
readln(nory2);
Case nory2 of 'Y':tvcharge:=Tvc*daysstayed;
                 'N':tvcharge:=0;
end;
//computing
Totalcharge:=roomcharge+tvcharge+tpcharge;


end.
and the error Error: Incompatible types: got "S80REAL" expected "LONGINT"
2 times
plz help me fix it
thanx
0
I have two mediaplayers in one form, how to get low volume in one mediaplayer and still high in other? Help me
0
Hello,

I use Delphi Seattle.
Can it connect to WAMP?
Further information here: http://wamp-proto.org/

I need to connect with a Multi Device Application to a system which uses WAMP

Thank you.
0
I want to combine, split, recombine Delphi forms just like in Chrome. Every form as a separate object created first when i need it. Solution can be normal VCL or Devexpress VCL. I looked at cxlayoutcontrol, but to slow if to many complicated structures. Same with DevExpress Docking, all is in one form and can  (probably) nor grow dynamically, if i want to open many instances of the same form.  Perhaps there is many ways to do this but witch one is the best?

Regards, Pär
0
I am currently hosting a delphi application on WIndows 7. I would like to move the application and database to a VM hosting Windows server 2010/2013 and a SQL Server DB. would there be any complications.
0
Hi, I'm using Delphi XE7. I'm writing my first IP related program. After getting the basics working, I will make it ping three addresses repeatedly and an onscreen display will indicate which sites are not reachable.
For now I am simply trying to ping an address and get something I can use to determine if I got a reply.
I have changed the IP address in this post because I probably shouldn't publish it. It is another computer on this network. If I open a command Prompt and ping this address, I get a reply. When I ping using my program, I get 'Socket Error # 10013  Access Denied'.
What am I doing wrong, or not doing ?
EEQ.txt
0
I am attempting to write contact information from a delphi application to an outlook address book.
I can get the address books, but can't figure out how to write to an address book, as all the samples I am seeing used the default contact folder only.


I can get the default contact folder as well, but user doesn't want to use the default contact folder, they want to use a custom address book.
is this even possible?
0
Hello,

I have a serious problem.
I use Delphi Seattle and Windows 10 on a notebook.

I need to work on this notebook for a month. Because the screen is very small I bought a big monitor and attached it  as a secondary monitor.

When I start Delphi I move it to the big monitor.
Every time I run my application (F9) it automatically moves back to the first, small monitor.
Because I am testing my new application a lot half of my time goes by setting back the Delphi to my big monitor.

How can I prevent it?
Thank you very much.
0
Hello everyone,
I'm using Timer to upload data to my table paradox every day but when i close the application the table become empty(it can be closed because of the shutdown of the computer all of a sudden) , i want to keep my table full  , any solutions please.
I'm using Delphi 7 and paradox 9 thanks.
0
In my Delphi project for Windows, I often render Japanese text on TCanvas of an image. Unfortunately, the vertical position of the rendered characters depends on the font family. When the font is MS Mincho or MS Gothic, it's positioned perfectly well. When it's Tahoma, the text goes a bit down. When it's Yu Mincho or Kozuka Gothic, it goes down a lot. So it's really difficult to align the text for all possible fonts. I need to calculate some parameter for every font to move the position upwards.

Some experts from another forum recommended to use the parameters from TTextMetric. There are several: tmAscent, tmDescent, tmExternalLeading, tmInternalLeading, etc. Theoretically, a certain combination of them and the font size in pixels should give me the desired value. But whatever I tried didn't work so far.

There must be a way to do it. Any ideas?
0
Hello guys

I have a function where I can set a print to as a default print.

Now I need to get the way to change the paper layout of it, I have a paper developed and I want to change it when I will print
a doc. Do you know any function or way to get that?


It is interesting that I can list all paper from my default printer with this function but I haven't found any way to set the paper with its name.

procedure TForm1.ListPaper;
var
  HPrinter: THandle;
  Forms: array of TFormInfo1;
  Count, Needed, Returned: DWORD;
  i: Integer;
begin
  Memo1.Clear;
  if OpenPrinter(nil, HPrinter, nil) then begin
    try
      if not EnumForms(HPrinter, 1, nil, 0, Needed, Returned) then begin

        // we should fail here since we didn't pass a buffer
        if GetLastError <> ERROR_INSUFFICIENT_BUFFER then
          RaiseLastOSError;

        Count := (Needed div SizeOf(TFormInfo1)) + 1;
        SetLength(Forms, Count);
        if EnumForms(HPrinter, 1, @Forms[0], SizeOf(TFormInfo1) * Count, Needed,
            Returned) then begin
          if Returned < Count then
            SetLength(Forms, Returned);
          for i := 0 to Returned - 1 do begin
             Memo1.Lines.Add(Format('Paper name: %s,   Paper size: %dmm x %dmm',
                            [Forms[i].pName,
                             Forms[i].Size.cx div 1000,
                             Forms[i].Size.cy div 1000]))
          end;
        end else
          RaiseLastOSError;
      end;
    finally
 

Open in new window

0
I'm trying to make a web server with TIdHTTPServer and so far it can display normal html pages. I want it to load this https://github.com/Facepunch/webrcon/tree/gh-pages site but It doesn't display it like it should be. A while back I made a web server with delphi 10 using the TcpServer component and that displays the site as it should be displayed but that component is no longer available in Rad Studio 10.2.2.

This is the following code for the command get event:
procedure Tfrmmain.idhtpsrvr1CommandGet(AContext: TIdContext;
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
  with TStringList.Create do
    begin
      LoadFromFile('htdocs\index.html');
      AResponseInfo.ContentText := Text;
      Free;
    end;
end;

Open in new window


I never use indy so if anyone can help I would be great full.
0
Hello,

I wrote an Android App in Delphi.

I noticed the some applications are installed directly under root directory e.g. /sdcard/AnkiDroid or /sdcard/doubleTwist.
However my app is installed somewhere else (I think /sdcard/Android/data).

How can I change it? Or if I can't how can I make the installation make a folder in the root directory?
I need the user to copy a file there so as my app would parse it.

Thank you very much!
0
Hi.

I need to print a report (a simple pricelist), with some images (4 images for 4 pages ) before printing the nomal pricelist report.

Which is the best method?

Thanks!
0
h.GIFwhen I run the project I get this error message
how can i solve this problem please.???
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.