How to get the Memory Used by a Delphi Program

You can get useful memory usage information out of the Delphi runtime without using any direct Win32 calls: unit X; uses FastMM4; //include this or method will return 0. …. function GetMemoryUsed: UInt64; var st: TMemoryManagerState; sb: TSmallBlockTypeState; begin GetMemoryManagerState(st); result := st.TotalAllocatedMediumBlockSize + st.TotalAllocatedLargeBlockSize; for sb in st.SmallBlockTypeStates do begin result := result + … Read more

WWW server reports error after POST Request by Internet Direct components in Delphi

I’m very sure that I’m POSTing the right data Since it does not work – obviously you do not (or Delphi does not – that makes no difference for server). You should start usual debugging loop: Observe reference working behaviour. Observe your program behavior Spot the difference Eliminate the difference Check if the program works … Read more

My program never releases the memory back. Why?

Task Manager is not the right tool to detect memory leaks. Delphi allocates large blocks of memory and keeps them later for future use, so certain increase in allocated memory is expected even after you release all resources. Any other results (and more detailed answers) can be obtained only by using specialize memory analysis tools. … Read more

How to send a HTTP Post Request in Delphi 2010 using WinInet [duplicate]

Major problems: The second parameter of InternetConnect should contain only the name of the server, not the entire URL of the server-side script. The third parameter of HttpOpenRequest should be the file name (URL) of the script, not the POST data! The actual POST data should be the forth parameter of HttpSendRequest. Minor problems INTERNET_OPEN_TYPE_PRECONFIG … Read more

How can I display Crystal XI reports inside a Delphi 2007 application?

This is the solution I’ve found, using ActiveX: First, register the Active X control like this: In Delphi, choose Component -> Import Component Click on “Type Library”, click Next Choose “Crystal ActiveX Report Viewer Library 11.5” Pick whatever Palette Page you want (I went with “Data Access”) Choose an import location Exit out of the … Read more

Delphi – get what files are opened by an application

Using the Native API function NtQuerySystemInformation you can list all open handles from all processes. try this example program ListAllHandles; {$APPTYPE CONSOLE} uses PSApi, Windows, SysUtils; const SystemHandleInformation = $10; STATUS_SUCCESS = $00000000; STATUS_BUFFER_OVERFLOW = $80000005; STATUS_INFO_LENGTH_MISMATCH = $C0000004; DefaulBUFFERSIZE = $100000; type OBJECT_INFORMATION_CLASS = (ObjectBasicInformation,ObjectNameInformation,ObjectTypeInformation,ObjectAllTypesInformation,ObjectHandleInformation ); SYSTEM_HANDLE=packed record uIdProcess:ULONG; ObjectType:UCHAR; Flags :UCHAR; Handle :Word; … Read more

FTP Over SSH (SFTP) In delphi 2010

SFTP and “FTP over SSH” are two separate things, and neither involves SSL (as someone else has suggested). SFTP is a sub-protocol of SSH while “FTP over SSH” is good/bad ol’ FTP tunnelled through an SSH connection with port forwarding. Either way, what you’re after is a Delphi SSH library. I was unable to find … Read more

How to avoid issues when embedding a TForm in another TForm?

I do this as well and I use the following routine to make it happen: procedure TMyForm.PlaceInsideContainer(Container: TWinControl); begin Parent := Container; Align := alClient; BorderIcons := []; BorderStyle := bsNone; ParentBackground := True; Show; end; I have no problems with this. The only difference that I could possibly imagine could be relevant is the … Read more