Delphi

Get internet time in delphi

蹲街弑〆低调 提交于 2020-01-01 10:16:20
问题 i want to get time and date from internet i used following code IdDayTime1.ReadTimeout := 5000; IdDayTime1.Host := 'www.time.windows.com'; IdDayTime1.Port := 37 ; Label1.Caption := IdDayTime1.DayTimeStr; but i get : socket error # 11004 whats is this and what did i do wrong my internet and other things are ok 回答1: DayTime protocol is not the NTP protocol. DayTime uses port 13, not 37. 37 is used by the Time protocol, which, again, in not the NTP protocol, which uses 123 (UDP). I do not know

How to set required Edit fields with a red border?

旧巷老猫 提交于 2020-01-01 10:07:10
问题 I want to require a little fields. And when they will not be filled in that they will be red and needed to fill in. before the post can be done Here is a screenshot of what do I want to achieve: 回答1: I would add a TShape , which can draw a red line around your edit box. If you want the red border to replace the normal TEdit border you can modify the properties of your Edit control so it has no Border. If you want the shape to be unfilled, change brush style to bsClear 回答2: You might hook the

Delphi - Enumerate the Disk(s) and other Drives on Windows PC [duplicate]

自古美人都是妖i 提交于 2020-01-01 10:01:13
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Get drive information (free space, etc.) for drives on Windows and populate a memo box I am quite new to programing (especially Delphi), and have been unable to find any examples as to how to enumerate all the drives on a PC. I really care about Hard Disks and CD-Rom drives but I have been unable to find anything useable. Can anyone point me in the direction of a good working sample? 回答1: The simplest way is

How to create a custom control which can scroll with a fixed row and column?

醉酒当歌 提交于 2020-01-01 09:57:15
问题 I'm trying to figure out how I can make a custom control in a way where user can scroll in all directions, but with a fixed row and column. A grid is not suitable for what I'm trying to do, because it scrolls column by column. I need horizontal scrolling to be smooth, pixel by pixel. I have no use for columns, only visual grid lines. Vertical scrolling should scroll not only the area on the right, but also the fixed region on the left. Same with horizontal scrolling: the header row should

When does background threads prevent the process of being terminated?

99封情书 提交于 2020-01-01 09:46:09
问题 Our program creates a background thread at the beginning of the program. The background thread does some database integrity checks and checks for stuff in the Internet using Indy. After 10 seconds, the background thread should be finished and since FreeOnTerminate is true, it will also clean itself up. We have noticed that in some cases, if the user closes the program too quickly, the process will still be alive until the background thread is finished. Since we couldn't exactly reproduce the

Delphi soap https authentication failure pops up a dialog box

╄→尐↘猪︶ㄣ 提交于 2020-01-01 09:33:24
问题 We have a delphi XE application that uses SOAP (THTTPRIO etc) communications which (in delphi) works over WinInet.dll, by default. We fixed the authentication code so that it works, using https authentication, and when the user name and password for https are correct, everything is fine. The problem is that when authentication details are incorrect, you get a message box from Windows, that is probably being popped up by WinInet.dll itself. I want to make that dialog box go away. I can't

What is the accepted way to use frames in Delphi?

僤鯓⒐⒋嵵緔 提交于 2020-01-01 09:12:10
问题 I was having my usual stroll around SO and bumped on some frames discussions. I'm mainly a Delphi hobbyist and not a professional so I had to learn how to use TFrames my own way witch is: Create a TFrame inside it's unit. Add that unit to the main form Uses clause. Have a private variable of that TFrame's type OnCreate of the form instanciates the TFrame and attaches it to a TPanel both on the Create and .Parent On one of my Actions set that TFrame.Visible := True and .BringToFront. This is

How do I convert a positive number to negative in Delphi?

你。 提交于 2020-01-01 08:45:29
问题 How do I convert a positive Integer to a negative with Delphi? I know you could use ABS(int) to convert a negative to a positive, but I need it to convert positive to negative. 回答1: from what I know there is no function for that. you can make if yourvariable > 0 then yourvariable := -yourvariable; 回答2: If you want to be absolutely sure to get a negative result (or zero), use number := -abs(number) 回答3: Ehhh... Too late but number := number * -1; would work too, but this change the symbol of

How do I convert a positive number to negative in Delphi?

北城以北 提交于 2020-01-01 08:45:07
问题 How do I convert a positive Integer to a negative with Delphi? I know you could use ABS(int) to convert a negative to a positive, but I need it to convert positive to negative. 回答1: from what I know there is no function for that. you can make if yourvariable > 0 then yourvariable := -yourvariable; 回答2: If you want to be absolutely sure to get a negative result (or zero), use number := -abs(number) 回答3: Ehhh... Too late but number := number * -1; would work too, but this change the symbol of

How can my installer optionally delete some files it didn't initially create?

早过忘川 提交于 2020-01-01 07:19:07
问题 I store all my program's settings in the appdata directory %appdata%/MyProgram. When there is a problem and the user has to reinstall, I want to ask whether to delete the data in that directory. I am using Inno Setup and added a custom page to prompt the user: if DirExists(ExpandConstant('{userappdata}\MyProgram')) then begin appdataPage := CreateInputOptionPage(wpSelectTasks, 'Stored Settings', 'Would you like to remove settings before re-install?', 'Please specify if you would like to