FAQ Database Discussion Community


Can I specify the save location for Delphi .dsk file?

git,delphi,ide
I want the Delphi IDE to remember which files I had open, etc., but if I enable the "Project Desktop" autosave option (Tools -> Options -> EnvironmentOptions in XE7) it puts the .dsk file in the root folder of my source code. We are using git for our version control,...

How to execute a file with a different extension's associated application?

delphi,winapi,shellexecute,file-association
In my application, I would like to be able to execute a file with an arbitrary name and extension using the program associated with a different extension. For example, say I have a file called file.dat, but I wanted to open it with Notepad, as if it was named file.txt...

Delphi and sleep function

delphi,timer,sleep
I am having some issues regarding the sleep function. I have my application which executes an external command with some options: str := 'C:\BERN52\MENU\menu.exe C:\BERN52\GPS\PAN\DAILY.INP C:\GPSUSER52\WORK\MENUAUX_DAILY.INP'; WinExec(Pansichar(str), SW_Shownormal); After that when this process is finished I should kill it and continue with another things. I did the following: Sleep(60000*StrToInt(Form1.Edit11.Text)); winexec('taskkill...

Infinite loop in parsing a string using pointer math

delphi,pointer-arithmetic,delphi-xe8
I have a routine that processes a C-like string, resulting in usual Delphi string: class function UTIL.ProcessString(const S: string): string; var SB:TStringBuilder; P:MarshaledString; procedure DoIt(const S:string;const I:Integer=2); begin SB.Append(S); Inc(P,I); end; begin SB:=TStringBuilder.Create; P:=PChar(S); while P<>nil do begin if P^<>'\' then DoIt(P^,1) else case (P+1)^ of '\','"':DoIt((P+1)^); #0,'n':DoIt(sLineBreak); 't':DoIt(#9); else...

Absolute addressing fields in a record type [duplicate]

delphi,record,discriminated-union
This question already has an answer here: How do I translate a C union into Delphi? 2 answers I am attempting to interface with an embedded system that transmits and receives data with a fairly simple format but has strict sizing requirements. In C, you would use a union...

Digital Metaphors Report Builder Surround Group Inside Box

delphi,report,reportbuilder
I'm interested in creating a report that contains a group in it. I'd like the group to be enclosed in a box where the box surrounds the group in every page I've tried this using lines and placing them in such a way that there is one on the group...

unelevated program starts an elevated updater, updater should wait for finishing of program

delphi,handle,createprocess,waitforsingleobject,shellexecuteex
I have 2 apps, program.exe and updater.exe, both written in Delphi5. Program runs without admin-rights (and without manifest), updater has a manifest with "requireAdministrator" because he must be able to write at Program-Folder to update program.exe. The problem is to launch updater and let him wait until program is closed....

How can I extract part of a PChar into a string?

string,delphi,optimization,pchar
During profiling I came across a function that was taking quite a bit of time, but essentially boiled down to this very simple piece of code: function GetSubstring(AInput: PChar; AStart, ASubstringLength: Integer): string; begin Result := Copy(AInput, AStart, ASubstringLength); end; This function returns the expected sub-string, but it doesn't scale...

Why does my application using OmniThreadLibrary Parallel.Pipeline continue remain running in the background after being closed?

multithreading,delphi,delphi-xe7,omnithreadlibrary
I'm using OmniThreadLibrary to implement a background pipleline for sending emails (refer to this SO question). I notice that after closing the application, it continues running in the background (seen in Windows Task Manager). That means that there is something wrong in my code in the way I implemented the...

How do we improve a MongoDB MapReduce function that takes too long to retrieve data and gives out of memory errors?

performance,mongodb,delphi,mapreduce
Retrieving data from mongo takes too long, even for small datasets. For bigger datasets we get out of memory errors of the javascript engine. We've tried several schema designs and several ways to retrieve data. How do we optimize mongoDB/mapReduce function/MongoWire to retrieve more data quicker? We're not very experienced...

What is required in Delphi 2007 to use Variant arrays?

delphi,com,delphi-2007,variant
I'm a newbie in Delphi, using Delphi 2007. I am learning things related to COM programming, in order to make a basic plugin to a program called Retail Pro. I have a little of background in .NET (C#, ASP), NetBeans (Java, JSF) and PHP. Anyway, I'm following this intro tutorial...

Can I check data in a 3rd party app with just the handle?

delphi
I have a 3rd party app. I have a handle to the TMainDlg, and to it's child TListBox. How can I find if item 2 is selected? Right now I am (not surprisingly) running into an "EAccessViolation at address " error. Any tips, tricks or suggestions? h2 := 0; h2...

Missing operator or semicolon in Delphi 7

delphi,delphi-7
I've got the error message "Missing operator or semicolon" on line 38 of this code: procedure TForm1.SpinEdit1Change(Sender: TObject); begin case SpinEdit1.Value of 1: Label6.Caption('rok'); // line 38 end; end; end. Does somebody know what I am missing? Thank you....

Unable to read final few Kb of logical drives on Windows 7 64-bit

delphi,wmi,freepascal,lazarus
I'm having some problems addressing logical drives. For clarity, my definition of 'Physical Disk' (PD) is the raw disk regardless of partitioning. 'Logical Drive' (LD) refers to a volume such as Drive E:, Drive F: etc. Using the examples from RRUZ (my hero SO member) and implementing the WMI Class...

Function that returns intersection of two TShapes, including TPaths?

delphi,firemonkey
Anyone have any knowledge of a function that returns the intersection TPath for two TShapes? Especially one that returns the intersection TPath of two TPaths. For instance: pthIntersection := PathIntersection(Path1,Path2); ...

Delphi XE4 - TImage is not displayed at runtime

delphi,delphi-xe4
Note: In the original question I was in a hurry and wrongly assumed that the problem was related to VCL Styles, but at the end after some testing it seems to be related to the SynGdiPlus.pas, so I removed the original description. The problem: TImage correctly shows the image at...

How to open and read “/proc/cpuinfo” on Android device in Delphi

android,delphi,cpu,firemonkey
Could anyone advise me how to open and read "/proc/cpuinfo" on Android device in Delphi? Original code: var i: integer; FS: TFileStream; LBuffer: TBytes; begin if FileExists('/proc/cpuinfo') then begin FS:= TFileStream.Create('/proc/cpuinfo', fmOpenRead); try SetLength(LBuffer, FS.Size); FS.ReadBuffer(Pointer(LBuffer)^, Length(LBuffer)); for i:= 0 to Length(LBuffer) - 1 do Memo1.Lines.Add(LBuffer[i]); finally FS.Free; end; end;...

Saving Excel workbook as PDF gives me an OLE error 800A03EC

excel,delphi,automation,ole
I have the following function that I want to use for creating a PDF from Excel. But when trying to save the PDF I get an OLE error 800A03EC that I simply can't figure out. I use the same approach to create PDF from Word and that works just fine....

How to remove duplicates in ListBox?

delphi,listbox,duplicate-removal
I use this code to remove duplicates: procedure TForm1.RemoveDuplicates(StrList : TStringList); var NoDuplicate: TStringList; i: Integer; begin NoDuplicate := TStringList.Create; try NoDuplicate.Sorted := True; NoDuplicate.Duplicates := dupIgnore; /// for i := 0 to StrList.Count - 1 do NoDuplicate.Add(StrList[i]) ; /// NoDuplicate.Sorted:= False; StrList.Assign(NoDuplicate) ; finally NoDuplicate.Free; end; end; It works...

Delphi Bug in Indy FTP List method?

delphi,ftp,indy
I'm trying to generate a list of files matching a certain file mask and Indy falls over with this error EidReplyRFCError with message '.': No such file or directory. I've tried several variations and this is the result: FTP.List( aFiles, '', true ); => this works FTP.List( aFiles, '*.*', false...

Passing SafeArray from Delphi through to ms-uiautomation libraries

delphi,microsoft-ui-automation
In relation to a previous question, I now have a partially working implementation that wraps up the TStringGrid, and allows automation to access it. Sort of anyway. I need to implement the GetSelection method of the ISelectionProvider, but even though I think I have create a pSafeArray, when I use...

IP*Works! SearchMailbox for IMAPS returns all available emails, even unmatching

delphi,imap,delphi-xe2
I am using IP*Works! V9. I try to restrict the returned emails to only the one matching a restriction using SearchMailbox. My code looks like this: lIMap.Mailbox := 'INBOX'; lIMap.SelectMailbox; lIMap.CheckMailbox; lIMap.Config('FETCHAFTERSEARCH=True'); lIMap.SearchMailbox('SUBJECT Diessenhofen UNSEEN'); if (lIMap.MessageCount > 0) then begin ... end; MessageCount always reflects the total number of...

How to correctly have modeless form appear in taskbar

windows,delphi,windows-7,delphi-xe6,windows-95
I am trying to achieve the age-old Delphi dream of having a modeless form appear in the taskbar. What is the correct way to have a modeless form appear in the taskbar? Research Effort These are my attempts to solve the problem. There are a lot of things needed to...

Odd compilation error message

delphi,delphi-xe6
The following snippet, in XE6 procedure TForm1.Test(CDS : TClientDataSet); var AGuid : TGuid; lResult : Longint; begin lResult := SysUtils.CreateGUID(AGuid); CDS.InsertRecord([AGuid, '', False]); end; produces the error message [dcc32 Error] Unit1.pas(73): E2150 Bad argument type in variable type array constructor Fwiw, in discovering this, I was trying to retrace my...

Multiple instances of the same service in Delphi

delphi,service,delphi-xe
I have have an old windows service made in delphi that now has to be installed multiple times in the same server, I am trying to change the code so I am able to change the service name as I am instaling the service but I cannot make it work....

When I load a new image in a TBitmap I must destroy the existing one first?

delphi,bitmap,delphi-2009
I am loading multiple images from resources in a TImageList at runtime with this code: Bitmap:=TBitmap.Create; MyIcons:=TImageList.Create(self); Bitmap.LoadFromResourceName(HInstance,'DEFAULT16'); MyIcons.AddMasked(BitMap,clRed); Bitmap.LoadFromResourceName(HInstance,'FOLDER16'); MyIcons.AddMasked(BitMap,clRed); Bitmap.LoadFromResourceName(HInstance,'BACK16'); MyIcons.AddMasked(BitMap,clRed); Bitmap.Free; I want to know if I should destroy the previous bitmap (Bitmap.Assign(nil)) when I load a new one or this is done automatically in...

Delphi XE8: problems running an external console application, waiting for its results and capturing its results

delphi,pipe,console-application,createprocess,waitforsingleobject
In Delphi XE8 under Windows, I am trying to call an external console application and capture its output. I use the following code, as described in Capture the output from a DOS (command/console) Window and also Getting output from a shell/dos app into a Delphi app: procedure TForm1.Button1Click(Sender: TObject) ;...

Why Application.OnException never runs?

delphi,exception-handling,delphi-xe2,delphi-7
Problem summary: The method assigned to Application.OnException never runs when an unhandled exception occurs. I create a blank project with only this unit and place a single button on Unit.dfm (this is based on an official example) : // Unit1.pas // ********* type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender:...

Why can't I use compiler intrinsics in an asm block?

delphi,assembly
Is this a compiler bug? program Project44; {$APPTYPE CONSOLE} uses System.SysUtils; function Test: integer; asm xor eax,eax add eax,SizeOf(NativeInt); end; begin WriteLn(Test); //Typically outputs 31 or 49 {$ifdef CPUX86} WriteLn('should be 4'); {$else} {$ifdef CPUX64} WriteLn('should be 8'); {$endif}{$endif} ReadLn end. This program outputs all kinds of things, except for...

Unable to use apostrophes in a string

delphi,delphi-xe8
So I just spent an hour trying to get this to work. I'm doing some tests on TWebBrowser, so I could apply my findings in a project. I wanted to test different ways of loading content into it (URL, LoadFromStrings() and EvaluateJavaScript()). The problem is, I can't in anyway to...

Set node state in a virtual tree

delphi,nodes,virtualtreeview
I have created a virtual tree with multiple node and I want to disable some of them. I've seen there's a States property of a node. Which is a property of a type TVirtualNodeStates so I've check what kind of states I can set and apparently TVirtualNodeStates is a set...

How to make TDBCheckBox update its DataField immediately after click?

delphi,checkbox,event-handling,delphi-xe3,data-aware
I have a form with several controls where the first one is a TDBCheckBox that is bound to DataField := 'enabled'. When the checkbox is clicked I want all the remaining controls to be enabled / disabled. procedure TMyAdapter.DataSourceDataChange(Sender: TObject; Field: TField); var Enabled: Boolean; begin Enabled := FModel.DataSet['enabled'].AsBoolean; FView.Label1.Enabled...

Get list of process

delphi,winapi
I need to get the list of process with their PID. I know how to get the PID by its handle and viceversa, but the problem is that I'm not the one who create the process, so I don't have the handle nor the PID. I didn't find exactly information...

AES encryption differences between php mcrypt and a Delphi component

php,delphi,encryption
I am using a Delphi component from chillkat which does AES encryption for me. It works like a charm and the server accepts my encrypted requests. So I tried to create a php pendant by using mcrypt. But the PHP mcypt result is different in comparison with the Delphi Chillcat...

How to call the original class's code when a class helper is in scope?

delphi,class-helpers
I'm doing some unit testing on an improved version of quicksort. The (hopefully) faster version is implemented using: TArrayHelper = class helper for System.Generics.Collections.TArray .... class procedure Sort<T>(var Values: array of T); overload; static; class procedure Sort<T>(var Values: array of T; Comparer: IComparer<T>); overload; static; .... I know for now...

What would the design look like for a class that implements a threaded email sending queue?

multithreading,delphi,delphi-xe7,omnithreadlibrary
So my application is a taxi call dispatch system, in which an operator receives calls over the phone and assigns received calls to a driver. On the Call Details form where the call detail is entered, as soon as the Save button is clicked, the form should close, should send...

Preventing component creation - Delphi

delphi,components
I am creating an application which makes use of several TTabsheets (from the TPageControl component). Is it possible to prevent a component (in this case a tab) from being created during the program startup? I want to manually create the tabs at a later stage. This is not a dynamic...

Reduce lines, use case?

delphi,case
How to reduce the lines, I could use case? I feel that this code is too large, no way to improve? if valmes.Text = '01' then WebTesta.OleObject.Document.all.Item('expmonth', 0).value := '0'; if valmes.Text = '02' then WebTesta.OleObject.Document.all.Item('expmonth', 0).value := '1'; if valmes.Text = '03' then WebTesta.OleObject.Document.all.Item('expmonth', 0).value := '2'; if valmes.Text...

It is required to free the IShellFolder interface returned by SHGetDesktopFolder ? and how?

delphi,delphi-2009
I am confused. I want to use the function PathToPidlBind from Jedi JCL and I see that they don't release the IShellFolder interfece reurned by SHGetDesktopFolder after using it. Microsoft docs says: "The calling application is responsible for eventually freeing the interface by calling its IUnknown::Release method.". I tried to...

Delphi, Lazarus - Listbox out of bound (0) TString

delphi,listbox,indexoutofboundsexception,lazarus,tstringlist
I simply can't seem to make any sense of the following error. Listbox out of bound (0) TString I have a form or window with a listbox and following code is supposed to work with it. It suppose to get a list of strings from an ini file and set...

How can I make the main form align correctly after my control height is autosized and then I maximize the form?

delphi,alignment,delphi-2009
This one I really don't know how to solve it... How to reproduce the problem: Run the code and and and shrink the window until the height of DriveBar is increased and then maximize the window. Then you can notice that Panel1 is no more top aligned, and between these...

Remove specific XML element in Delphi

xml,delphi,delphi-7
I have an xml document looks like this: <?xml version="1.0"?> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ExtensionData /> <Name>ali</Name> <Age>37</Age> <Father> <ExtensionData /> <Name>I</Name> <Age>72</Age> </Father> <Mother> <ExtensionData /> <Name>M</Name> <Age>62</Age> </Mother> </Person> I am using Delphi 7. How can I remove all...

Opening a project in landscape in iOS doesn't display correctly in Delphi XE8

ios,delphi,firemonkey,delphi-xe8
When I open my projects in landscape in iOS the form appears to be rotated 90 degrees to the right and also doesn't fit in the screen. When I open it in portrait I don't get any problems. Also when I then turn it to landscape, it displays correctly. Does...

How to add menu items separators programmatically on Windows?

windows,delphi,drop-down-menu,menuitem
I have a mainmenu on my Form and I want to be able to insert separator to it programmatically not during design time. I went through context popup menu for the mainmenu that lists all the available properties and did not find anything that will allow me to insert separator....

How can I convert PNG to GIF keeping the transparency?

delphi,graphics,png,gif
How can I convert PNG to GIF keeping the transparency? I would have hoped that using the Assign( ) method would work but it doesn't seem to migrate transparency. In the GIF, it's represented as black. png:=TPngImage.Create; try png.LoadFromFile(sFile); // comes from file: png.TransparencyMode; // comes from file: png.Transparent //...

Can I pass type parameters to a testcase in DUnitx?

unit-testing,delphi,generics,dunitx
I'm writing testcases for my FastCode project. I've written a generic tester like so: TTest<T> = record private class var Def: System.Generics.Defaults.IComparer<T>; class var F: FastDefaults.TComparison<T>; strict private class function Slow(const Left, Right: T): integer; static; class function Fast(const Left, Right: T): integer; static; class constructor Init; public class procedure...

Can I compare Real48 using generics.defaults?

delphi,delphi-xe7,delphi-xe8
The following code to compare two Real48's (6-byte float) compiles and runs, but either generates non-nonsensical results or generates a AV. program Project44; {$APPTYPE CONSOLE} uses System.SysUtils, System.Generics.Defaults; begin try WriteLn(System.Generics.Defaults.TComparer<Real48>.Default.Compare(100.0,100.0)); WriteLn('all ok, press space'); except on E:exception do WriteLn(e.Message); end; ReadLn end. It should output 0, but if it...

What is the different between “Console target” and “GUI target” in DCC32 option?

delphi
DCC32.exe has two options: -CC: Console target -CG: GUI target Is there any different using these two options to build dpk and dpr files?...

Strings getting corrupted in ComboBox.AddObject. How to add them the proper way?

delphi,delphi-xe7
I'm adding strings with objects (also strings) to a TComboBox, but getting corrupted strings when trying to retrieve them later. This is how I'm adding them: var i: Integer; sl: TStringList; c: Integer; s: PChar; begin for i := 1 to tblCalls.FieldCount do if tblCalls.Fields[i - 1].Tag = 1 then...

Delphi 7 - Save to a Specific .INI Files Name

delphi,delphi-7
I modified the MasterMan82's TIniFile code to read and write multi values from & to TEdit/TComboBox and TMemo. Forgive my vague questions, my english is not good. So, what I mean is: I have a couple of .INI files, A.ini, B.ini, C.ini ....and so on. I just store A.ini as...

Currency Formatting with Delphi

delphi,currency,object-pascal
I am trying to writte a code in Delphi, which will be displaying a given number in currency format like this: Now it works if filled whole number and another field until any paramater is updated. I'd be happy to have a code which would displaying a number in currency...

SetProcessWorkingSetSize does not work in compiling 64bit

delphi,memory
I use the following command to reduce the memory usage of my program, I'm actually testing it, only when I compile the program in 64bit this command does not work fot, no error occurs, only the memory in task managerIt does not decrease too, since in compiling 32bit works perfectly,...

Delphi Access Violation when moving button on form

delphi,button,access-violation
I am trying to move 2 buttons on the form using a while loop checking for the buttons left property, but I have an Access Violation. I am exeting the procedure with CreateThread() The code: procedure AnimButton1(); var ImageCount: integer; var b1, b2: integer; begin try while (b2 <> 187)...

Does “enable runtime themes” affect performance?

delphi,themes,delphi-2007
I've recently changed "enable runtime themes" value in the project options and I'm wondering if it's value affects application's performances and, in case, in which manner? Hope someone can clarify me this point.

Component event detection in Delphi

delphi,events,components
I am developing a DataAware component and executing some code after the database is open. This is the code I have at the moment: TMyDataAwareComponent = class(TDataAwareComponent) private { Private declarations } procedure ToBeExecutedOnAfterOpen(DataSet: TDataSet); protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; end;...

Is it a bug that attempts to compile this code results in IDE terminating or the compiler failing to run?

delphi,delphi-xe3
Beware of Exit command usage in inline functions! I have been using Delphi XE3 here. Symptom In certain circumstances, when a call is made to an inline function that contains Exit command, and the return value of the inline function is used directly in WriteLn(), the compiler reports an error...

Referring to interface versus to an object implemeting it?

delphi
Given the following declarations: var XML:IXMLDocument; and var XML:TXMLDocument; What's the difference of working with the XML variable from end-user point of view? What's preferred?...

See when Delphi Twebbrowser starts loading a page

delphi,twebbrowser
I am using delphi's TWebbrowser to navigate to a php file I created. I have a loading screen I would like to show when the page is loading or processing commands. How can I detect when it is being refreshed or still loading. currently I am using the ondocumentcomplete to...

FastReport Master/Detail in Delphi XE2

oracle,delphi,fastreport
I need some help creating a Master/Detail report in Fast Reports for Delphi XE2. I have a simple form which accepts 2 dates and 2 times from a user. I then have 2 Oracle Datasets on the form with which to retrieve my data. When the user presses the print...

Call Delphi XE6 unicode dll from C# asp.net

c#,delphi,dll
before opening the topic searched any more responses served me, my error remains, have created a dll in Delphi XE6 64x which is as follows: function GeraChave(Action : PAnsiChar; StrCrip : PAnsiChar; Cnpj : PAnsiChar; idPC: PAnsiChar): PAnsiChar; stdcall; var KeyLen : Integer; KeyPos : Integer; OffSet : Integer; Dest,...

Signing certificate error when update apk from XE7 to XE8

android,delphi,firemonkey
My Android apk was developed by XE7. Now I upgrade the project with XE8. The IDE report a signing certificate error when install the apk to Android device: Unable to create process: Unable to install D:\GMTWork\SalesApp\Android\Release\SalesApp\bin\SalesApp.apk. Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] Embarcadero's solutions are: Manually uninstall the previously-installed application from your Android device....

Flush file buffers in on non-Windows platforms

delphi,delphi-xe8
I have a logging component that uses a TByteStream for storing log contents and TFileStream for writing them to disk periodically. I need to ensure after writing to the file stream the file is updated immediately. So far I know only of FlushFileBuffers(), a Windows-specific function for that. How to...

Delphi - Use a string variable's name in assignfile()

file,delphi,variables,assign
Is it possible to use a variable in the assignfile command? Eg. f : Textfile ; sFile : string ; {contains 'MyFile.txt' as content} ... cFileDir = 'C:\Users\User\Desktop\Data Engine\Data\Country' ; ... Assignfile(f, cFileDir + '\' + sFile) ; ... I appreciate your help very much. if it's unclear I'll edit...

TypeCasting : what is difference between below 2 lines of code?

delphi,delphi-7
what is the difference between below 2 lines of code. Both are trying to get the path and one is working and other is throwing error. i am working on Delphi-7 Path:= (((FFormOwner as TForm).Designer) as IDesigner).GetPrivateDirectory; --Working Path:= IDesigner(TForm(FFormOwner).Designer).GetPrivateDirectory ; --Error Below is the code which is using line...

Is there any Delphi implementation of MurMurHash3?

delphi,murmurhash
Is there any Delphi implementation of MurMurHash 3? I tried implementing it myself, but my implementation is actually slower that the MurMurHash2. Is it normal? Is there any other implementation? This is mine: function MurMur3_32(const S: AnsiString; const Seed: LongWord=$9747b28c): LongWord; const c1 = $cc9e2d51; c2 = $1b873593; r1 =...

Custom component controls keep re-creating

delphi,firemonkey
I'm a newbie in Firemonkey/custom controls so sorry if this is a banal question or a duplicate one but I'm stuck and can't figure it out. Here's the code of my custom control unit swScheduler; interface uses System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.StdCtrls, FMX.Calendar, FMX.Objects; type TswScheduler = class(TControl) private {...

How to use XPath on TXMLDocument which has namespace prefixes?

xml,delphi,soap,xpath
I have an XML packet received from a third-party web server: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <SomeResponse xmlns="http://someurl"> <SomeResult> ..... </SomeResult> </SomeResponse> </soap:Body> </soap:Envelope> To be cross-platform capable, this XML is loaded into Delphi's IXMLDocument:...

How to use TThread.Synchronize() to retrieve the text of a TEdit control?

delphi,c++builder
How can I use TThread.Synchronize() to retrieve the text of a TEdit control. Should I assign the TEdit text to a global variable or something?

do oncalculate fields in one table using values from another table

delphi
I am doing calculations in my KLOG table. However, my PRICES table has the data I need for the calculations in the KLOG table. Example : KLOG table has PRICE_ID field (integer). So does the PRICES table. So I am trying to do something like this (oncalculatefields of the KLOG...

'Session Ended' when lauching app from Delphi to iOS Simulator

delphi,ios-simulator,delphi-xe7,paserver
I'm trying to deploy a multi-platform application (written in Delphi XE7 + Firemonkey) to iOS Simulator, through these parameters: Delphi XE7 OSX 10.8 Mountain Lion XCode 5.1.1 Command Line Tools PAServer 15.0 (iOS SDK 7.1 - also tested with 6.1) My Application needs to work in Windows, Android, iOS and...

Need help to find FireMonkey equivalent of the VCL TpaintBox.Canvas.Handle in the context of building graph

delphi,firemonkey
Preambule: I'm working with Black Magic Design (BMD) Decklink input card to acquire HD video signal. They provide C++ Sample with their SDK. I've successfully translated the c++ sample into Delphi (VCL). I've also isolated the API call in a TDecklink witch I want it to be available to the...

Open file manage and get selected file

android,delphi,firemonkey
Using Delphi XE 8 and building Android app, can I browse files in the device by opening a certain file manager app installed on the device and then get back that selected file name and path ?

Custom component Convertion from delphi 5 to delphi 7

delphi,delphi-7,delphi-5
Recently I got a chance to convert delphi-5 code to delphi-7. At first I started converting Custom components to delphi-7. While compiling delphi-5 components in delphi-7 system is throwing error stating "Undeclared identifier: IFormDesigner". After googling I came to know IFormDesigner should be replaced with IDesigner. So after replacing IFormDesigner...

How to get enabled property of a control?

delphi,properties
In Delphi it is possible to get the process name and class name of any control which is clicked system wide via windows api. process name: GetWindowThreadProcessId(Hwnd, ProcessId) by process ID one can get to the process name class name: SetLength(ClassName, 255); SetLength(ClassName, GetClassName(Hwnd, pchar(ClassName), 255)); Is there an easy...

How to catch WM_DEVICECHANGE in a control other than TForm?

delphi,delphi-2009,windows-messages
Until today I was using the following code to catch WM_DEVICECHANGE message in application main form and it worked pefectly. But if I try to use this in my custom control I don't get notifyed on device insert or remove. What is happening ? TDriveBar = class(TCustomPanel) private procedure WMDeviceChange(var...

How to add new online ressources to RAD Studio help system

delphi,delphi-xe2,h2reg
Delphi for a while uses the MS Help V2.x help system. It provides the program h2reg.exe to add additional context sensitive help files, such as ones for third party components. If MS document explorer, the program used to display help, cannot find a certain help page locally, it searches through...

How can I send data between 2 applications using SendMessage?

delphi,winapi
I have 2 applications- Manager with this code: procedure TForm1.CopyData(var Msg: TWMCopyData); var sMsg: String; begin if IsIconic(Application.Handle) then Application.Restore; sMsg := PWideChar(Msg.CopyDataStruct.lpData); Caption := Caption+'#'+sMsg; Msg.Result := 123; end; procedure TForm1.Button1Click(Sender: TObject); const WM_MY_MESSAGE = WM_USER + 1; var h: HWND; begin Caption := 'X'; h := FindWindow('TForm1', 'Client');...

Get which capture group matched a result using Delphi's TRegex

regex,delphi
I've written a regex whose job is to return all matches to its three alternative capture groups. My goal is to learn which capture group produced each match. PCRE seems able to produce that information. But I haven't yet been able coerce the TRegEx class in Delphi XE8 to yield...

How to make my custom control be notified when his form or application receives and loses focus?

delphi,focus,delphi-2009
I want my control to receive distinct notifications only when it's parent form (not panel or something else, just the main form of this control) receives and loses focus. Doesn't matter if the focus is switched from another form of the application or between my application and other application, it...

Delphi - converting string back from UTF-8

osx,delphi,utf-8
I am having a problem converting a UTF-8 encoded string back into something usable by delphi. The application is written in XE8 and is being deployed on windows and OSX. The application uses the LimeLM API dll and dylib libraries on windows and OSX respectively. Everything works fine on windows,...

Lazarus/FreePascal, Synapse send file to TCPBlockSocket

delphi,freepascal,lazarus,netcat,synapse
I tried to make an analogue nc (netcat) tool. Open file and send it in to TCP socket. client (sender) side procedure TForm1.SpeedButton3Click(Sender: TObject); var Client:TTCPBlockSocket; FS: TFileStream; begin Client:=TTCPBlockSocket.Create; Client.RaiseExcept:=True; Client.Connect('192.168.1.95','9999'); FS:=TFileStream.Create('/tmp/test_print.pdf',fmOpenRead); FS.Position:=0; Client.SendStream(FS); FS.Free; Client.CloseSocket; Client.Free; end; server (reciever) side nc -l 192.168.1.95 9999 > test.pdf After run...

Loop through records on a cxgrid and update a field/column

delphi,devexpress,tcxgrid
I have a cxGrid where I apply a filter to select certain records. When that is done I want to be able to update a field/column in the grid to mark each record that is to be used for the next operation. I haven't been able to figure this out...

Delphi TADOQuery: Format data before SavetoFile

delphi,tadoquery
I have an application that allows a user to run a query over a remote database using a TADOQuery component. The query results are then saved to an XML file using the TADOQuery's SaveToFile method. I've recently run into an issue whereby if a line feed character (hex "0A") exists...

Delphi form inheritance, visual bug

forms,delphi
I have this bug in delphi i'm inherating from different forms (3 in total) and when i'm creating the last child, it creates every component 3 times. It's dll project and the dll makes the different forms. I have a launcher for testing that dll. On calling the function that...

Setting “Server” programatically with a TFDConnection

mysql,delphi,firedac
TFDConnection.Params.Server is not a valid published property in Delphi XE7. How can I set the server location programatically? I have 2 MySQL servers (test and production) that are at different ip's and based on what I am doing in the application, I want to easily switch back and forth between...

Delphi - extract string between tags (duplicate tags)

delphi
I'm trying to write a function to extract a string between two tags. The problem is that the first tag is a duplicate in that string with an unknown count e.g. Str := 'Delphi App Hello Hello SomeText here Hello Hello Hello This is a Test!'; What i want exactly...

Asynchronous TADOQuery's OnFetchComplete not synchonized to main thread

delphi,asynchronous,delphi-xe4,delphi-xe8,tadoquery
When using TADOQuery with [eoAsyncFetchNonBlocking] and attaching to OnFetchComplete event I found that OnFetchComplete is not executing in the main thread (tested in XE4 and XE8). I assume this a bug*, since most of us will do work in the UI on these type of event. I believe this to...

PasswordChar in Delphi XE8's TMemo

delphi,delphi-xe8
I spent a few hours searching Google to see if anyone had shared their articles, but came up empty-handed. If it's possible, I want to know how to enable/disable the passwordChar in Delphi XE8's TMemo to hide user input like in TEdit. ? Maybe via a checkbox! So when the...

how to connect to a NIC card or network adapter knowing its IP address?

delphi,network-programming,ip-address,windows-10
Say I have two NIC or adapter card on my system and also I found their IP address through the following code: procedure TForm4.RetrieveLocalAdapterInformation(strings: Tmemo); var pAdapterInfo, pTempAdapterInfo: PIP_ADAPTER_INFO; AdapterInfo: IP_ADAPTER_INFO; BufLen: DWORD; Status: DWORD; strMAC: String; i: Integer; begin strings.Clear; BufLen:= sizeof(AdapterInfo); pAdapterInfo:= @AdapterInfo; Status:= GetAdaptersInfo(nil, BufLen); pAdapterInfo:= AllocMem(BufLen);...

Issues with AES Encryption using SynCrypto

delphi,encryption,cryptography,aes
Am trying to encrypt a file using SynCrypto.pas with AES 256, but it fails if I try to encrypt a file whose size is not a multiple of 16 bytes. The decrypted data contains junk. Example: Original string in txt file we are testing the file Encrypted String [ù[„|wáî}f *!4ìÙw¬•ü¨s...

connection refused when I try to connect client with server

delphi,datasnap
I made a basic client / server datasnap applications and it work in local network through http but when I tried to connect from the internet I get connection refused, here are the steps I followed: I set at the server component TDSHTTPService to connect through port no 8081 then...

Firemonkey ListView item indexes not updating

delphi,listview,firemonkey
I'm using a TListView in Firemonkey. On startup, I create 3 list view headers and keep references to them for future use (specifically inserting items below each header). FItemHeader:= LV.Items.Add; FItemHeader.Purpose:= TListItemPurpose.Header; FItemHeader.Text:= 'Items'; FChargeHeader:= LV.Items.Add; FChargeHeader.Purpose:= TListItemPurpose.Header; FChargeHeader.Text:= 'Charges'; FPaymentHeader:= LV.Items.Add; FPaymentHeader.Purpose:= TListItemPurpose.Header; FPaymentHeader.Text:= 'Payments'; Then, I've added a...

Delphi passing Types in parameters

delphi,delphi-xe2
an example, I need to do this to solve a problem in a framework I am developing : //Unit2 : procedure A(aForm : TForm; AClassType: TFormClass); begin ShowMessage (AClassType(aForm).edtUser.text); end; ... //Unit1 : Uses Unit2; begin form1 := TForm1.Create; Try A(form1, TForm1); Finally form1.Free; End; end; The compiler does not...

How cand I include a bitmap in my custom component (if is possible)?

delphi,components,delphi-2009
I am writing a component (a button) which needs a bitmap to be displayed on it. I don't want to make an ImageList property and the user assigns an image. I want that button to have only the image chosen by me. I tried to include the bitmap in a...

Undeclared identifier in Code Insight?

delphi
unit lc type TSite = class(TObject) ... public function BlockRef_Delete( AlcBlockRef: THandle ): integer; ... unit main; interface uses ... lc ...; var Site: TSite; At any place in unit 'main', where im using any of the 'Site's method, i get Undeclared identifier {Site's method name here}. I checked the...

How to draw on a single GLSceneViewer using GLCanvas but not on all viewers?

delphi,opengl,glscene
I'm usually using TGLCanvas on GLDirectOpenGL1Render to draw lines like this: uses GLCanvas, GLRenderContextInfo {...} procedure TForm1.GLDirectOpenGL1Render(Sender: TObject; var rci: TRenderContextInfo); var glc: TGLCanvas; begin glc:=TGLCanvas.Create(GLSceneViewerL.Width, GLSceneViewerL.Height); with glc do begin //Drawing lines here Line(0, 0, 10, 20); Line(10, 20, 30, 30); {...} end; glc.Free; end; But in current project...

Delphi generic frame

delphi,frames
I'm still here with a questione about Delphi frames. I would like to create an application that use various type of frames in order to manage different database tables, so trying to understand how to do this kind of task I've create a simple Delphi Form: unit main; interface uses...

Expression illegal in evaluator

delphi,delphi-xe2
I'm trying to code something but there is happening something I don't understand. I get some values from a database and loop over them and change some of them if needed. This is what I'm trying to do: if qryGeneral.fieldbyname('B_PRIJS').IsNull or qryGeneral.fieldbyname('B_PRIJS').Value = 0 then begin if (qryGeneral.fieldbyname('V_PRIJS').Value <> 0)...

User defined macro in CnPack

delphi,delphi-ide
Do you know how to create an user defined macro in CnPack ? The instructions shipped with it say it can be done but don't explain how. I tried to sign in the dedicated forum, twice, but it didn't work. I searched for some tutorials online but didn't find anything...

HasValidFileNameChars fails for UNC files

delphi,delphi-xe,delphi-xe7
For me HasValidFileNameChars function (in Delphi XE7) returns false for UNC files: B:= IOUtils.TPath.HasValidFileNameChars('\\ETA-PC\tests\test.ini', FALSE) B is false now This means that if you try to validate the filename that I show in my test (yes the file is real and as you can see its name is correct) HasValidFileNameChars...