delphi-7

Automatically allowing Ctrl+A to select all in a TMemo?

半腔热情 提交于 2019-12-20 19:05:13
问题 In Delphi 7's TMemo control, an attempt to do the key combo Ctrl + A to select all does not do anything (doesn't select all). So I've made this procedure: procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var C: String; begin if ssCtrl in Shift then begin C:= LowerCase(Char(Key)); if C = 'a' then begin Memo1.SelectAll; end; end; end; Is there a trick so that I don't have to do this procedure? And if not, then does this procedure look OK? 回答1: This is more

Voice Recording/Saving in Delphi

泪湿孤枕 提交于 2019-12-20 15:29:51
问题 Is there a component or code that allows the following: Record a spoken word (or words) and save it/them to a file that can be played back. The file must be able to be played back on XP, Vista and Windows 7. The file can be either stand alone or saved to a datasource. [Using Delphi 7 for creating apps on XP and using Absolute Database.] 回答1: The functions in MMSystem.pas let you do this using Windows API. You can either use high-level functions such as the MCI functions and PlaySound, or low

How to detect that a form is being destroyed across the Application?

时间秒杀一切 提交于 2019-12-20 12:40:55
问题 We have many forms in our application, and I need a global event handler to detect when one of the forms is being destroyed (and then take some action). p.s: I want to avoid adding code to each form that will need to send a message to the main form when it's about to destroy. also most of the forms are created and destroyed dynamicaly at run-time. I was thinking about maybe use a global TApplicationEvents. What is the best approach for this? 回答1: A constraint on modifying code in existing

Hard disk id of SATA drives

孤街浪徒 提交于 2019-12-20 06:39:31
问题 I am using Hard disk ID for my software to check if the authentic user is using the software. For IDE type hard disk i get the id using the procedure GetIdeSerialNumber. but in case of SATA drives it gives the id as blank. Then in case of SATA drives i am using volume id as unique id. but volume id will change when system is formatted Now I want to know which hard drive i am using ,and how to get the hard disk id of SATA drive in delphi 7 ? EDIT: the software according to client

OnKeydown for “-” does not get fired in Delphi 7 application

被刻印的时光 ゝ 提交于 2019-12-20 06:32:56
问题 We are using Delphi 7 enterprise edition, application is build on windows XP, testing on both Windows XP and Windows 7. In an application we maintain, something strange is happening. For some reason hitting the "-" key (qwerty layout, between "0" and "=" keys on top) does not register at all. We checked in the OnKeyDown of the edit we found it with, the OnKeyDown of the form (with and without key preview) and even the ProcessMessage routine, but the event for this key never reaches the

Saving fonts and colors (delphi)

谁说胖子不能爱 提交于 2019-12-20 05:59:16
问题 My system gives the user to change the color and font of several items on multiple forms. I need a way to save these fonts and colors. My system uses sql so is there a way to save them there or is there another way to save them. 回答1: You can create a second table named users_prefereces with 2 column: users and preferences. preferences will be a json string where you save the user preferences. in that way you can have a struct with all the user preferences like a string. when you get the

How to read from Resource file in delphi 7?

和自甴很熟 提交于 2019-12-20 05:10:32
问题 I have made resource file and have compiled and linked it with my delphi unit.But I am facing problems when reading from that resource file. implementation {$R *.dfm} {$R 'stuff.res' 'stuff.rc'} procedure TForm1.FormCreate(Sender: TObject); var vExeFile: string; RS: TResourceStream; begin RS := TResourceStream.Create(HInstance, 'ExeTest', RT_RCDATA); try vExeFile := ExtractFilePath(ParamStr(0)) + 'tmp.exe'; RS.SaveToFile(vExeFile); finally RS.Free; end; end; I have tried above code but it

Bypass OutputDebugString in Delphi 7?

亡梦爱人 提交于 2019-12-20 00:00:43
问题 I'm wondering if it's possible to bypass the OutputDebugString? I'd like the OutputDebugString output showing up in DebugView and not in the internal Delphi Event Viewer window. But i can't find a way to tell Delphi not to swallow the OutputDebugString. Any ideas? regards 回答1: That is not possible. OutputDebugString sends string to debugger (as its name suggests). There can be only 1 active debugger per process. You run your application under Delphi - Delphi got the messages, since its a

How to implement identical methods with 2 and more Classes?

醉酒当歌 提交于 2019-12-19 18:26:26
问题 I want to write a TCheckBox and TRadioButton descendants having 3 identical methods. TMyCheckBox = class(TCheckBox) procedure DoSomething1; procedure DoSomething2; procedure WMSize(var Message: TWMSize); message WM_SIZE; end; TMyRadioButton = class(TRadioButton) procedure DoSomething1; procedure DoSomething2; procedure WMSize(var Message: TWMSize); message WM_SIZE; end; // the following procedures are common for both classes, so in fact // TMyCheckBox.DoSomething1 do the same as

how to display progress bar?

佐手、 提交于 2019-12-19 11:26:08
问题 I created a steganography(hide text in bitmap) application and I want to add a progress bar to show how long the process works. procedure TForm1.Button2Click(Sender: TObject); var x,y,i,currentBit,bitInChar,currentChar,currentPixel,newPixelValue,pixelsToSkip,skippedPixels: integer; pixels: PByteArray; bmp: TBitmap; stringToHide: string; begin if Image1.Picture.Bitmap=nil then showmessage('gambar belum dipilih') else memo1.lines.clear; stringToHide := AntiKeyLoggerMemo1.text; stringToHide:=