delphi-7

Where to save ini file dependent to machine (not user) on windows

↘锁芯ラ 提交于 2020-01-01 11:45:34
问题 My application is currently storing settings in an INI file under the current user's profile ( C:\Documents and Settings\<CurrentUser>\Application Data\MyApplication\MySettings.ini under WinXP). But I've realised some of these settings are unique to the machine not the user and thus want (actually need) to save them in a single location for all users. Is there a folder location on Windows XP (and up) where I can store user independent settings? NOTE: I don't want to store them in the same

Read GUID value stored in registry

时光总嘲笑我的痴心妄想 提交于 2020-01-01 11:34:07
问题 I try to read a GUID value stored as a binary value in registry in Delphi. When I read it with BintoHex, but the result is in reverse order. It seems that I have to swap bytes but I thought BinToHex would do it. I refered to this thread but I can't find the right solution : how to convert byte array to its hex representation in Delphi It seems that it is due to little Eendian. Below, you can see the GUID stored in registry Here is my code : var s : string; buffer : pointer; ... begin getmem

Read .wav file using delphi

梦想的初衷 提交于 2020-01-01 07:12:31
问题 I now currently try to read .wav file using delphi here is my code : type TWaveHeader = packed record Marker_RIFF: array [0..3] of char; ChunkSize: cardinal; Marker_WAVE: array [0..3] of char; Marker_fmt: array [0..3] of char; SubChunkSize: cardinal; FormatTag: word; NumChannels: word; SampleRate: longint; BytesPerSecond: longint; BytesPerSample: word; BitsPerSample: word; Marker_data: array [0..3] of char; DataBytes: longint; end; TChannel = record Data : array of double; end; some private

Free a TThread either automatically or manually

柔情痞子 提交于 2019-12-31 22:27:10
问题 I have a main thread and a separate thread in my program. If the separate thread finishes before the main thread, it should free itself automatically. If the main thread finishes first, it should free the separate thread. I know about FreeOnTerminate, and I've read that you have to be careful using it. My question is, is the following code correct? procedure TMyThread.Execute; begin ... Do some processing Synchronize(ThreadFinished); if Terminated then exit; FreeOnTerminate := true; end;

Delphi 7 - Save to a Specific .INI Files Name

若如初见. 提交于 2019-12-31 07:52:29
问题 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 a variable in the code. It is not possible to put all the file names in the code. When I opened A.ini, make some changes, click SAVE to save any changes made, and success!. Of course, because A.ini has been defined in the code

Delphi 7 - Save to a Specific .INI Files Name

▼魔方 西西 提交于 2019-12-31 07:52:04
问题 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 a variable in the code. It is not possible to put all the file names in the code. When I opened A.ini, make some changes, click SAVE to save any changes made, and success!. Of course, because A.ini has been defined in the code

Delphi 7, TFileStream cant open files with special characters

最后都变了- 提交于 2019-12-31 06:28:20
问题 This line: TFileStream.Create(fileName, fmOpenRead or fmShareDenyNone); drops an exception if the filename contain something like ñ 回答1: You are, ultimately calling CreateFileA , the ANSI API, and the characters you use have no ANSI encoding. The only way to get beyond this is to open the file with CreateFileW , the Unicode API. You might not realise that you call CreateFileA , but that's how the Delphi 7 file stream is implemented. One easy way to solve your problems is to upgrade to the

Delphi 7, TFileStream cant open files with special characters

早过忘川 提交于 2019-12-31 06:28:06
问题 This line: TFileStream.Create(fileName, fmOpenRead or fmShareDenyNone); drops an exception if the filename contain something like ñ 回答1: You are, ultimately calling CreateFileA , the ANSI API, and the characters you use have no ANSI encoding. The only way to get beyond this is to open the file with CreateFileW , the Unicode API. You might not realise that you call CreateFileA , but that's how the Delphi 7 file stream is implemented. One easy way to solve your problems is to upgrade to the

Delphi 7, TFileStream cant open files with special characters

孤街浪徒 提交于 2019-12-31 06:28:04
问题 This line: TFileStream.Create(fileName, fmOpenRead or fmShareDenyNone); drops an exception if the filename contain something like ñ 回答1: You are, ultimately calling CreateFileA , the ANSI API, and the characters you use have no ANSI encoding. The only way to get beyond this is to open the file with CreateFileW , the Unicode API. You might not realise that you call CreateFileA , but that's how the Delphi 7 file stream is implemented. One easy way to solve your problems is to upgrade to the

Getting typeface and Windows name of font that is not installed

拈花ヽ惹草 提交于 2019-12-31 03:09:06
问题 Can someone tell me how can I get the typeface name of a font? And how can I take the Windows name of the font having the typeface name? Like "arialblackno1.ttf" that have typeface "arialblack". but I am looking to get the typeface name of a font that isn't installed, it is just in a folder. 回答1: You say in a comment that you need the name of a font that isn't installed in Windows. There are two ways of doing this that I can think of:- Use FreeType Or, use GDI+, and PrivateFontCollection