delphi-2009

Finding System Fonts with Delphi

↘锁芯ラ 提交于 2019-12-21 02:07:06
问题 What is the best way to find all the system fonts a user has available so they can be displayed in a dropdown selection box? I would also like to distinguish between Unicode and non-Unicode fonts. I am using Delphi 2009 which is fully Unicode enabled, and would like a Delphi solution. 回答1: The Screen.Fonts property is populated via the EnumFontFamiliesEx API function. Look in Forms.pas for an example of calling that function. The callback function that it calls will receive a TNewTextMetricEx

How to properly access query-results created in background thread?

守給你的承諾、 提交于 2019-12-20 11:11:04
问题 I want to execute a database query in a background thread. The OmniThread library will help me with all the thread stuff, but there is one thing I don't understand so far: Every thread needs a separate database connection. The background thread therefore creates the DB connection, creates the query and then executes it. Now I could access the query results using the query object of the background thread. But after the query is executed, I want to access the query results in the main thread.

How can I cast an object to a generic?

给你一囗甜甜゛ 提交于 2019-12-20 10:46:50
问题 I'm trying to cast a returned base object to it's specific generic type. The code below should work I think but generates an internal compiler error, is there another way to do this? type TPersistGeneric<T> = class private type TPointer = ^T; public class function Init : T; end; class function TPersistGeneric<T>.Init : T; var o : TXPersistent; // root class begin case PTypeInfo(TypeInfo(T))^.Kind of tkClass : begin // xpcreate returns txpersistent, a root class of T o := XPCreate(GetTypeName

how can i see how much of the stack space is currently used in my delphi app?

独自空忆成欢 提交于 2019-12-20 10:44:12
问题 how can i see how much of the stack space is currently used in my delphi app? i had a very strange error that sounds like stack trouble. i'd like to add it to my app's log to get some idea how much stack space is in use/remaining. using the debugger is probably not so great because the routine can be called many times. thank you! 回答1: {$IFDEF MSWINDOWS} function currentStackUsage: NativeUInt; //NB: Win32 uses FS, Win64 uses GS as base for Thread Information Block. asm {$IFDEF WIN32} mov eax,

Need form to stay on top of parent only

五迷三道 提交于 2019-12-20 10:14:33
问题 I have a multi-window application. My main form is a child of the desktop. My application can create other forms that also become children of the desktop. However, I have a special case where my main form needs to create a form that will always stay on top of it. I had this working to an extent....however, if I then create other windows in the application this form seems to stay on top of even these! So basically what I need to know is... How can I create the form from my main form and make

Advice on moving to a multi tier Delphi architecture

风格不统一 提交于 2019-12-20 09:59:49
问题 We have a relatively large application that is strongly tied into Firebird (stored procedures, views etc). We are now getting a lot of requests to support additional databases and we would also like to move a lot of the functionality from the client to the server. Now seems like a good time to move to a 3(4) tier architecture. We have already looked at DataSnap 2009 and RemObjects SDK/DataAbstract. Both seem like they would do the job, but are there any advantages/disadvantages we should look

Convert string to PAnsiChar in Delphi 2009

蹲街弑〆低调 提交于 2019-12-20 09:47:37
问题 I'm converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString. Here's an example to demonstrate the issue I'm having: var s: PAnsiChar; ... s := PAnsiChar(Application.ExeName); With Delphi 2007 and previous versions, s := PChar(Application.ExeName) would return the application exe path. with Delphi 2009, s := PAnsiChar(Application.ExeName) returns only 'E'. My guess is that's because I'm converting a unicode

Fade all other windows of an application when a dialog is shown?

纵然是瞬间 提交于 2019-12-20 08:30:58
问题 How to dim / fade all other windows of an application in Delphi 2009. Form has an AlphaBlend property, but it controls only transparency level. But it would be nice if we can have something like this (Concentrated window) . Even stackoverflow.com does that, when we try to insert a link/ image etc in the post. How can we achieve this in a delphi application? 回答1: Here is a unit I just knocked together for you. To use this unit drop a TApplication component on your main form and in the

Delphi - TScrollBox issue after X number of components

陌路散爱 提交于 2019-12-20 04:08:21
问题 I noticed in one of my test applications after I have added so many TPanels to a TScrollBox I run into a problem with the ones drawn past that certain amount. I disable the scroll box prior to drawing and it is always cleared before drawing so there are no relative position problems. Initially I thought maybe I had run into some sort of maximum height to paint. So you know the arrangement is width occupying panels stacked vertically. So I created a new project to try and identify and tackle

error in Delphi loadlibrary()

若如初见. 提交于 2019-12-20 02:57:08
问题 i have given a chance to my software user to select dll from openfile dialog.(so my user can download dlls form my website and use it with the main project ). everything is working fine and it can even find that dlls is provided by me or selected an invalid dll.but the problem raises if the user selects a renamed file(eg : apple.txt file renamed to apple.dll ). i typed the code like this try dllHandle := LoadLibrary( pwidechar(openfiledialog1.filename)) ; catch { showmessage if it is not a