Posts Tagged ‘Delphi’
I want to read, write (modify) and save Unicoded document with TMemo component in Delphi. And failed.
On the Internet, I had found a procedure to load Unicode files into TMemo, and it worked. But Unicoded string shows like this “???????” (without quotation marks). No, it didn’t work. It seems to be quite difficult to do so.
Here is the code I used. I named TMemo to “Doc”.
Be sure, it didn’t work!
procedure TForm1.LoadUnicodeFile(const filename: String; strings: TStrings); procedure SwapWideChars(p: PWideChar); begin while p^ <> #0000 Do begin p^ := WideChar(Swap(Word(p^))); Inc(p); end; end; var ms: TMemoryStream; wc: WideChar; pWc: PWideChar; begin ms:= TMemoryStream.Create; try ms.LoadFromFile(filename); ms.Seek(0, soFromend); wc := #0000; ms.Write(wc, sizeof(wc)); pWC := ms.Memory; if pWc^ = #$FEFF then Inc(pWc) else if pWc^ = #$FFFE then begin SwapWideChars(pWc); Inc(pWc); end else ; strings.Text := WideChartoString(pWc); finally ms.free; end; end; // This function is necessary to validate the file. function IsTextFileUnicode(const TextFilename: string): boolean; var FS : TFileStream; w : word; begin result := false; if FileExists(TextFilename) then begin FS := TFileStream.Create(TextFilename, fmOpenRead or fmShareDenyNone); try if FS.Read(w, SizeOf(w)) = SizeOf(w) then result := (w = $FEFF) or (w = $FFFE); finally FS.Free; end; end; end; procedure TForm1.Button1Click(Sender: TObject); var OD: TOpenDialog; begin Doc.Lines.Clear; OD := TOpenDialog.Create(Self); with OD do begin Filter := 'Text Files (*.txt)|*.txt'; if Execute then begin if IsTextFileUnicode(FileName) then LoadUnicodeFile(FileName, Doc.Lines) // Load Unicoded text else Doc.Lines.LoadFromFile(FileName); // Load ANSI text end; end; end;
I changed my mind about New Audio Components. I felt that I gave up too easy.
Their audio capture still does not work anyway.
On the other hand, I deleted Audio Lab.
I received some information via e-mail. Actually a few. One person told me about CPP and Delphi components, ActiveX and such.
Thank you very much for you to care about this software.
I looked at the things the one recommended.
New Audio Components v.2.5 (for Delphi)
Their (or his) Demo “Recorder”, did not record anything. I changed my Windows’ mixer setting, but it did not work either. So I did not want to try more. I threw them to the Trash.
AudioLab v.4.3.1 for Visual Studio, Cpp Builder, Delphi…
This is heavy duty! And it worked, I could record the sound. It was very easy, too. But how to do more than very simple? Their demo works but “So what?”, I must say.
Their help is not at all helpful, but they explain so many classes they have done. Easy but a bit more advanced demo could not be wrong.
It is free for Non-profit products, but without source code. They have made some silly dialogue, too. They were a little rush of new version or what?
Without the help that really helps, also demo as not good enough. What if it is really good! There is nothing to do with me but I think they will lose many customers.
And I could not play the MIDI file with it. They want to say it’s “Audio Stuff” blah blah blah …
It feels like this is pretty useless.
I still have it on my computer, because it is free, but I do not think I will use them.
I’ve made a little progress.
This is the next version.
Small numbers at the end of the version number can be a little more then when I release it.
A new interesting feature there. Do you see it? I do not mean to Skins. You can record sound from other audio sources. So far, I have tested with YouTube, Internet radio, DVD, CD, Windows Media Player, RealAudio Player, Quick Time … and it worked!
Thank you, you told me about it, Mr… It was actually quite fun to examine them.
I was thinking to do a bit visually attempt to convince you. So I looked on the web thoughtfully such as skins. And I found them.
If you are using an old Delphi like me.., it’s fun. You can make your app with the skin but won’t cost you anything. It is freeware components.
It includes many skins, and you can make your own, too. SXSkin uses Graphics32 which supports many graphic formats with GraphicEx image library by Mike Lischke (http://www.soft-gems.net/).
You can do a lot with this skin component, though.
Unfortunately, manufacturers’ site (http://www.saarixx.info/sxskincomponents/en/) is not available now, but you can download it from Torry’s Delphi Page (http://www.torry.net/). Go to Components > Component Packs > Skins and Themes Packs(http://www.torry.net/pages.php?id=1544) and seek there!
AlphaControls Lite Edition
This is a light version of AlfaControls and works without any limitations in Delphi 5/6/7/2005/2006/2007/2009/2010 and C++ Builder 6/2006/2007/2009/2010. And it works.
You can download it from AC Team (http://www.alphaskins.com).