delphi-7

Can I load a memo or rich edit from a text file on server?

纵然是瞬间 提交于 2019-12-22 11:38:08
问题 I designed a website and its uploaded to server and is working fine. in one of these pages i get some info from users like their addresses and ... and save them to a text file. Can i make an application and load a rich edit or memo from that file? that file has itself address like www.mysite.com/my_text_File.txt thank you for your help. 回答1: Yes, you can. function WebGetData(const UserAgent: string; const Server: string; const Resource: string): AnsiString; var hInet: HINTERNET; hURL:

How to get music to play in Delphi 7?

心不动则不痛 提交于 2019-12-22 08:36:28
问题 I need to get music to play in the background in the start of the program in the OnFormActivate event for my program. I have the song I want to use but I dont know what command Delphi needs to use in order to start playing that song. Thanks for you help guys :) 回答1: Use the TMediaPlayer component, it's on the System tab of the component palette. procedure TForm1.FormActivate(Sender: TObject); begin MediaPlayer1.FileName := '<fill in>.mp3'; MediaPlayer1.Open; MediaPlayer1.Play; end; Set the

How can I force Delphi 7 to load the whole executable?

可紊 提交于 2019-12-22 08:30:09
问题 This is almost a clone of the same question for Delphi 2006, but I'd like a solution for Delphi 7. I'm also getting the External Exception C0000006. Is it possible to make a Delphi 7 load all the executable in memory? 回答1: You'll need add a post-built action to whatever build automation you are using. Find an external tool that modifies the PE flags of an executable and call that from your build script. Obviously this must happen after the executable has been built. I would recommend using

How to get folder path from Known folder GUID in Delphi

会有一股神秘感。 提交于 2019-12-22 05:13:15
问题 I have a KNOWNFOLDERID and I would like to know the corresponding path like C:....\folder. KNOWNFOLDERID can be found here. http://msdn.microsoft.com/en-us/library/bb762584%28VS.85%29.aspx I d like to use win api (I don't want to build an array with all KNOWNFOLDERID and paths). Thanks 回答1: Simply call the SHGetKnownFolderPath API function. Since this function was added in Vista, it won't be declared in the library units that shipped with Delphi 7. So you'd need to declare it yourself. type

How to get folder path from Known folder GUID in Delphi

大憨熊 提交于 2019-12-22 05:11:01
问题 I have a KNOWNFOLDERID and I would like to know the corresponding path like C:....\folder. KNOWNFOLDERID can be found here. http://msdn.microsoft.com/en-us/library/bb762584%28VS.85%29.aspx I d like to use win api (I don't want to build an array with all KNOWNFOLDERID and paths). Thanks 回答1: Simply call the SHGetKnownFolderPath API function. Since this function was added in Vista, it won't be declared in the library units that shipped with Delphi 7. So you'd need to declare it yourself. type

In Delphi 7, how do I escape a percent sign (%) in the Format function?

自闭症网瘾萝莉.ら 提交于 2019-12-22 02:51:48
问题 I want to do something like this: SQL.Text := Format('select foo from bar where baz like ''%s%''',[SearchTerm]); But Format doesn't like that last '%', of course. So how can I escape it? \% ? %% ? Or do I have to do this: SQL.Text := Format('select foo from bar where baz like ''%s''',[SearchTerm+'%']); ? 回答1: Use another % in the format string: SQL.Text := Format('select foo from bar where baz like ''%s%%''',[SearchTerm]); 回答2: %% , IIRC. 回答3: Obligatory: http://xkcd.com/327/ :-) Depending on

Indy 10 - IdSMTP.Send() hangs when sending messages from GMail account

别说谁变了你拦得住时间么 提交于 2019-12-21 16:18:46
问题 I am trying to send an e-mail using gmail account (Delphi 7, Indy 10) with these settings: TIdSmtp: Port = 587; UseTLS := utUseExplicitTLS; TIdSSLIOHandlerSocketOpenSSL: SSLOptions.Method := sslvTLSv1; Everything seems to be set ok. I get this response: Resolving hostname smtp.gmail.com. Connecting to 74.125.77.109. SSL status: "before/connect initialization" SSL status: "before/connect initialization" SSL status: "SSLv3 write client hello A" SSL status: "SSLv3 read server hello A" SSL status

Reading data with TIdUDPServer

淺唱寂寞╮ 提交于 2019-12-21 06:39:14
问题 I would like to read data from an electronic device that sends data to my PC by UDP. I have programmed a UDP server in Delphi. An exception occurs in class EIdSocketError (Failure #10049). Here is my code: procedure TForm1.Button1Click(Sender: TObject); begin IdUDPServer1.Bindings.add.IP := '192.168.1.1'; //Electronic device ip IdUDPServer1.Bindings.add.Port:= 49152; //Electronic device port IdUDPServer1.OnUDPRead:= UDPRead; IdUDPServer1.Active:=True; end; procedure TForm1.UDPRead (Sender:

Thread Posting messages to Main UI Thread are blocked/removed

℡╲_俬逩灬. 提交于 2019-12-21 05:02:30
问题 My problem is that if a thread Posting messages rapidly to the main UI thread and if I update the UI at that time, sometimes the main message queue get stuck (I have no better words to describe this). Here is the simplified repro code: const TH_MESSAGE = WM_USER + 1; // Thread message TH_PARAM_ACTION = 1; TH_PARAM_FINISH = 2; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); private ThreadHandle: Integer; procedure ThreadMessage(var Message:

Delphi: How to send command to other application?

我的梦境 提交于 2019-12-21 03:52:35
问题 How to send & receive commands from other Delphi created applications? I want to send command to another application that I've written. 回答1: Sender: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; const WM_MY_MESSAGE = WM_USER + 1; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R