delphi-xe2

How can a program change its own resources?

允我心安 提交于 2019-12-08 10:44:48
问题 I would like to store some XML program preferences as a resource in a Delphi application. The resource would be modified based on user changes. I have no problem creating the XML and loading it as a resource, and can modify the xmlDocument that I load it into, but I don't know how to write the document back. Is this even possible? I would prefer not to end up with 2 files in the end (.exe and .xml). 回答1: The answer is both yes and no. Yes, it is possible to update resources in a binary using

Similar search in integer field by filter property

给你一囗甜甜゛ 提交于 2019-12-08 07:51:01
问题 I have a ADODataSet where the "Filtered" property is set to True (Filtered:= True;) When I apply the filter: [No] like '2%' an error "Filter can't be opened" pops up. [No] is a field in the ADODataSet of integer type. When I apply a similiar filter to string columns it works fine. e.g: [LastName] like 'Jo%'. Any idea ? Thanks. 回答1: I agree with Ken, if you're looking for numeric values 20 through 29 or 200 through 299, then search based on the values. If you still want to do as you ask,

crop and align inserted BMP in Delphi

狂风中的少年 提交于 2019-12-08 07:14:53
问题 I want to crop and align the inserted BMP from the clipboard. I'm trying for 2 days but still nothing workable... procedure TForm1.act1Execute(Sender: TObject); var BMP : TBitmap; begin BMP := TBitmap.Create; BMP.Assign(Clipboard); BMP.SetSize(400,200); Img1.picture.Graphic := BMP; BMP.Free; end; procedure TForm1.act1Update(Sender: TObject); begin (Sender as TAction).Enabled := Clipboard.HasFormat(CF_BITMAP); end; end. 回答1: If I understand you right, you need to center the bitmap in the Image

Please explain package use

荒凉一梦 提交于 2019-12-08 06:40:10
问题 Please explain package use (in short sentences with small words (for Dummies)). I just moved from D7 to XE2 and packages seem much more prevelant, and I seem to need to qualify a lot more things. In D7 I would say uses windows and now I must say uses winapi.windows . I find that when I call MessageDlg() I can't pass in mtError , I need to qualify it. Before I go too far down the wrong road - what's the simple solution? Can I somehow continue to use my old code with package names which I

execute dynamic sql in datasnap client

老子叫甜甜 提交于 2019-12-08 06:33:57
问题 Is it possible to share database connection between datasnap server and client? I want to execute dynamic sql in client and receive results. 回答1: I found 2 ways to execute dynamic sql in client side 1) Using DbxConnection (dbExpress) // Server code function TServerMethods1.GetConnection: TDbxConnection; begin Result := DBConnection.DBXConnection; end; //Client code dbxConnection := ServerMethods.GetConnection; command := dbxConnection.CreateCommand; command.Text := 'SELECT COUNT(1) FROM

Using a C# DLL in Delphi only uses the first function parameter

拟墨画扇 提交于 2019-12-08 03:52:41
问题 I use C# DLL Export (UnmanagedExports - https://www.nuget.org/packages/UnmanagedExports) to make my managed C# DLL Accessible to unmanged Code like Delphi. My problem is that only first function parameter is transfered from delphi to the C# dll: The C# DLL Part [DllExport("SomeCall", CallingConvention.StdCall)] public static String SomeCall([MarshalAs(UnmanagedType.LPWStr)] String data1, [MarshalAs(UnmanagedType.LPWStr)] String data2) { //Data1 is never filled with some string data. String

Delphi IAccessible Get_accState influences Get_accName?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 02:15:22
问题 I'm currently adding the IAccessible-Interface to my derived VCL-Components to be able to implement automated UI-Testing for my application. After implementing the interface i didnt see the name in the properties of my components read out via external tools, though i saw while debugging it was set. After "some" (or more likely very much) testing around i found out, that the return value of Get_accState seems to be influencing the name: When I return S_OK in this function (independet from the

delphi - how to get type of enum

有些话、适合烂在心里 提交于 2019-12-08 01:32:08
问题 I know how to get enum value from integer value, and I have this code function GetEnumValue(intValue:integer):TMyType begin if(ordValue >= Ord(Low(TMyType)))and(ordValue <= Ord(High(TMyType)))then result :=TMyType(ordValue) else raise Exception.Create('ordValue out of TMyType range'); end; I have similiar code like above in many place for many enum type other than TMyType, I want encapsulate that code to single protected code on base class, so inherited class can use it. but I dont know how

dynamically create popup menu tree from sql server table in Delphi

放肆的年华 提交于 2019-12-07 20:54:03
问题 I have a table like this: id parent_id name 1 1 Root 2 1 Car 3 1 Plane 4 2 BMW 5 4 CLK How can I dynamically create popup menu with all subitems in Delphi? This is how it should look like: 回答1: Assuming root element has NULL as Parent_ID you can issue the request Select ID, Parent_ID, Name from all_my_menus order by Parent_ID nulls first, ID where Menu_ID = :MenuIDParameter 1 <NULL> Root 8 <NULL> another root 2 1 Car 4 1 Plane 3 2 BMW 5 4 CLK You would also cache in-memory created menu items:

open source component for postgreSQL

╄→гoц情女王★ 提交于 2019-12-07 20:03:29
问题 I would like to know if there are any open source components available for Delphi XE-2 that can connect to postgreSQL other than using outdated techniques like ODBC. For now just Win32 support is needed, but if Win64 and OS-X support is also available that would be a bonus. I googled around a bit, but the only lib that's available (ZEOS) looks like it is no longer in active development. There does seem to be a patch for Delphi XE2 but I could not get it to compile. 回答1: As of right now: No.