Delphi

How do do things during Delphi form startup

老子叫甜甜 提交于 2020-07-09 13:25:30
问题 I have a form one which I want to show a file open dialog box before the full form opens. I already found that I can't do UI related stuff in FormShow, but it seems that I can in FormActivate (which I protect from being called a second time...) However, if the user cancels out of the file open dialog, I want to close the form without proceeding. But, a form close in the activate event handler generates an error that I can't change the visibility of the form. So how does one do some UI related

Multi-monitor screenshot - positioning mouse cursor

守給你的承諾、 提交于 2020-07-08 19:23:39
问题 I have a procedure which takes a screenshot of a monitor and optionally includes the mouse cursor in the snapshot. The original function was only for one monitor. When drawing the mouse cursor, it currently shows properly only on the Main Monitor. But, I can't figure out how to position it on any other monitor. See the comments towards the end of this procedure. procedure ScreenShot(var Bitmap: TBitmap; const MonitorNum: Integer; const DrawCursor: Boolean; const Quality: TPixelFormat); var DC

Sporadic Access Violation in TJvMemoryData.InternalSetFieldData

跟風遠走 提交于 2020-07-07 11:27:12
问题 I am trying to resolve an access violation in a Delphi XE7 application which is occurs in this code, which is part of the Jedi VCL JvMemoryDataset component (current source at Github): begin Data^ := Ord(Buffer <> nil); Inc(Data); if Buffer <> nil then Move(Buffer^, Data^, CalcFieldLen(Field.DataType, Field.Size)) <---------- AV here else FillChar(Data^, CalcFieldLen(Field.DataType, Field.Size), 0); end; The code sporadically causes a read access violation at address 04020111. Is there an

Sporadic Access Violation in TJvMemoryData.InternalSetFieldData

放肆的年华 提交于 2020-07-07 11:26:04
问题 I am trying to resolve an access violation in a Delphi XE7 application which is occurs in this code, which is part of the Jedi VCL JvMemoryDataset component (current source at Github): begin Data^ := Ord(Buffer <> nil); Inc(Data); if Buffer <> nil then Move(Buffer^, Data^, CalcFieldLen(Field.DataType, Field.Size)) <---------- AV here else FillChar(Data^, CalcFieldLen(Field.DataType, Field.Size), 0); end; The code sporadically causes a read access violation at address 04020111. Is there an

Sporadic Access Violation in TJvMemoryData.InternalSetFieldData

亡梦爱人 提交于 2020-07-07 11:25:25
问题 I am trying to resolve an access violation in a Delphi XE7 application which is occurs in this code, which is part of the Jedi VCL JvMemoryDataset component (current source at Github): begin Data^ := Ord(Buffer <> nil); Inc(Data); if Buffer <> nil then Move(Buffer^, Data^, CalcFieldLen(Field.DataType, Field.Size)) <---------- AV here else FillChar(Data^, CalcFieldLen(Field.DataType, Field.Size), 0); end; The code sporadically causes a read access violation at address 04020111. Is there an

Which is the best place to initialize code? [duplicate]

让人想犯罪 __ 提交于 2020-07-07 08:15:46
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Splash Screen Programatically Show a splash screen while a database connection (that might take a long time) runs Which is the best place to initialize code such as loading INI file? I want first to show the form on screen so the user know that the app is loading and ONLY after that I want to call lengthy functions such as LoadIniFile or IsConnectedToInternet (the last one is REALLY slow). The OnCreate is not

How do I upload a file using http post? Delphi 2009

人走茶凉 提交于 2020-07-05 07:26:56
问题 My goal is to upload a text file via HTTP post I am using Delphi 2009. Say for example to the following URL https://www.example.com/ex/exampleAPI.asmx/Process I understand it can be done by using the TIdHttp component. And the following call IdHttp1.Post(); But I cant figure out how to set up everything i.e. specifying the url and including the file to be posted. Thanks. 回答1: TIdHTTP has two overloaded versions of Post() that take a filename as input: var Response: String; Response := IdHTTP1

How do I upload a file using http post? Delphi 2009

偶尔善良 提交于 2020-07-05 07:25:10
问题 My goal is to upload a text file via HTTP post I am using Delphi 2009. Say for example to the following URL https://www.example.com/ex/exampleAPI.asmx/Process I understand it can be done by using the TIdHttp component. And the following call IdHttp1.Post(); But I cant figure out how to set up everything i.e. specifying the url and including the file to be posted. Thanks. 回答1: TIdHTTP has two overloaded versions of Post() that take a filename as input: var Response: String; Response := IdHTTP1

Is there any function/procedure as ReplaceString but for whole words on Delphi?

百般思念 提交于 2020-07-04 02:53:18
问题 Is there any function/procedure as ReplaceString but for whole words on Delphi? I just need to replace substring to the new one when it's a whole word. For example: substring - > newstring substring, -> newstring substring123 -> substring 回答1: You can use the built-in regex library to do this. For example: {$APPTYPE CONSOLE} uses System.RegularExpressions; const InputString = 'a Substring, substring123, some more text'; begin Writeln(TRegEx.Replace(InputString, '\bsubstring\b', 'newstring',

Unknown column in field list

本秂侑毒 提交于 2020-07-03 07:51:56
问题 I'm trying to insert some information to MySQL with Pascal, but when I run the program I get the error unknown column 'mohsen' in field list This is my code procedure TForm1.Button1Click(Sender: TObject); var aSQLText: string; aSQLCommand: string; namee:string; family:string; begin namee:='mohsen'; family:='dolatshah'; aSQLText:= 'INSERT INTO b_tbl(Name,Family) VALUES (%s,%s)'; aSQLCommand := Format(aSQLText, [namee, family]); SQLConnector1.ExecuteDirect(aSQLCommand); SQLTransaction1.Commit;