Delphi

How to judge number of buckets for TBucketList

女生的网名这么多〃 提交于 2020-01-04 04:45:11
问题 I've been using the TBucketList and TObjectBucketList for all my hashing needs, but never experiemented with switching the number of buckets. I vaguely remember what this means from Data Structures class, but could someone elaborated on the nuances of this particular class in Delphi The following table lists the possible values: Value Number of buckets bl2 2 bl4 4 bl8 8 bl16 16 bl32 32 bl64 64 bl128 128 bl256 256 回答1: TBucketList and TObjectBucketList store pointers. The hash function they

Asynchronous threads drawing in Bitmaps Delphi

孤者浪人 提交于 2020-01-04 04:41:04
问题 If many asynchronous threads draw in a global TBitmap, it will rise me an error? Should I create my code using a critical section? (From my surf on the internet I found that the TBitmap.Draw is not thread safe) Another question: If many synchronous threads draw in a global TBitmap and a VCL Timer read asynchronously the content from the TBitmap will this rise me an error? Thanks! 回答1: Since your threads are all modifying the same bitmap, you need to serialize all access to that bitmap. That

WebBrowser and OLECMDID_SELECTALL

筅森魡賤 提交于 2020-01-04 04:15:09
问题 When I open the Google web page using: WebBrowser1.Navigate('http://www.google.com.au/advanced_search?hl=en'); it opens with the cursor in the edit box. So when I use: WebBrowser1.ExecWB(OLECMDID_SELECTALL,OLECMDEXECOPT_PROMPTUSER,vaIn, vaOut); it only copies where the cursor is. Not the whole web page, which is what I want to copy. my code is: procedure Pause() begin //code to pause until page loads. end; procedure TForm2.Button22Click(Sender: TObject); var s:String; vaIn, vaOut: OleVariant;

Delphi 2010 - Decode Base64 encoded image from XML doc

让人想犯罪 __ 提交于 2020-01-04 04:07:08
问题 I am trying to decode a base64 encoded EMF image from an XML document in my application and render it on screen, however, it never seems to appear. If I copy/paste the data from the XML document into Notepad++ and use the Base64 Decode option and save the file as a .emf it opens fine in mspaint. So I think the issue is how I am decoding it. I have tried the following decode methods described in these articles: How to encode / decode Base 64 string http://www.swissdelphicenter.ch/torry

Can I monitor the progress of an S3 download using the Cloud.AmazonAPI?

早过忘川 提交于 2020-01-04 04:06:14
问题 Is there a routine available in TAmazonStorageService to monitor the progress of a download of an object? I read that it is possible using the AWS SDK hooking the WriteObjectProgressEvent, but I couldn't find anything related in the documentation of Embarcadero's AmazonAPI. 回答1: I don't think this is currently implemented in Delphi. What you can do is create a stream wrapper that will notify about progress of writing to it. So for example you can write following to monitor progress via

Delphi XE7 Android Fullscreen (hide softkeys)

感情迁移 提交于 2020-01-04 03:55:24
问题 How to Fullscreen in XE7, hiding both the top (title) and bottom (softkey) toolbar? In XE6 I could adjust the AndroidManifest to make my application go fullscreen and without the actionbar by writing in the application section: android:theme="@android:style/Theme.Holo.NoTitleBar.Fullscreen" > In XE7 this did no longer do the job, I found a Russian website with more information on the matter. Here is the first 'static' option: Suppose the situation: The application should always work in full

Fill a TStringList in a DLL

流过昼夜 提交于 2020-01-04 03:54:33
问题 I want to fill a TStringList inside a DLL. My approach seems to be wrong regarding memory management documentaion, but it works and doesn't cause an error or AV. Can someone tell me, if that code is OK? Not sure how I can fill a class in general in a DLL. programm EXE function MyClass_Create: IMyClass; stdcall; external ... var _myClass_DLL: IMyClass; //shared interface in exe and dll procedure FillList; var list: TStringList; begin list := TStringList.Create(true); //memory allocated in EXE

Speech recognition not working well

岁酱吖の 提交于 2020-01-04 03:45:07
问题 I have followed an article on Speech Recognition with Delphi (SAPI 5.3). http://edn.embarcadero.com/article/29583 I created a basic application. but the problem is that the application has got it all wrong ! it doesn't get what I am saying correctly. if i say for example : "word", it get "ward". and so on. is there any better way to do speech recognition anyone can give me ? 回答1: For any speech recognition tool, you do have to make sure you give it enough training so it can recognize the way

Delphi use reflection in a class procedure for the getting dynamic class type

无人久伴 提交于 2020-01-04 03:37:15
问题 I want use reflection on the current class inside a class procedure/function (static method). How can I do without using the "Self" keyword? And without harcode the class name: this procedure should be override in the descendants. class procedure AAA.SetTableAndSequence; var c : TRttiContext; t : TRttiType; begin c := TRttiContext.Create; try t := c.GetType(Self.ClassType); ... finally c.Free; end; end; 回答1: You can use ClassInfo and GetType: class procedure AAA.SetTableAndSequence; var c:

Delphi tree view with checkboxes: sometimes the checkboxes are invisible

情到浓时终转凉″ 提交于 2020-01-04 02:52:15
问题 I have a problem. I have a TTreeview descendant that shows checkboxes just fine on my own computer and all other I have tested myself. TVS_CHECKBOXES is set using SetWindowLong . In the Loaded method I set/maintain checked states with StateIndex := 2; , Item.State := TVIS_CHECKED , etc. So far so good. But now a person contacted me where the treeview checkboxes does not show at all on his WindowsXP SP3. (He even provided me with a screenshot.) From the program behavior, I can say the default