delphi-xe3

Converting decimal/integer to binary - how and why it works the way it does?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 14:00:58
As already asked David in a comment of an answer here , I'm really interested on how this function works, since I can't seem to get the same (correct) values if changing result length from 32 to 16 or 8. I used function function IntToBin(Value: LongWord): string; var i: Integer; begin SetLength(Result, 32); for i := 1 to 32 do begin if ((Value shl (i-1)) shr 31) = 0 then begin Result[i] := '0' end else begin Result[i] := '1'; end; end; end; which somehow works just fine. (1 is returned as 000....001, 2 as 000....010, 3 as 000...011, etc...). However, since I only needed 8 chars long string

retrieve image saved on database [duplicate]

感情迁移 提交于 2019-11-28 11:45:19
This question already has an answer here: How to insert image into database using TADOQuery Component Only 2 answers Store images in MS-Access Database using Delphi6 1 answer I'm using this code to load images into my Timage: begin if OpenPictureDialog1.Execute(Self.Handle) then Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName); end; Then I'm using this code to store into my ms access database: var AStream : TMemoryStream; begin Adotable1.Append; AStream := TMemoryStream.Create; try Image1.Picture.Graphic.SaveToStream(AStream); AStream.Position := 0; if Adotable1.Active then begin

How to convert a record from host to network byte order (big endian)?

99封情书 提交于 2019-11-28 10:39:11
问题 I have a record: Tconnecting = record var a: int64; b: integer; c: integer; end; which I need send to server using UDP protocol I fill it packet.a := StrToInt64('0x1234567890'); packet.b := 0; packet.c := RandomRange(1, 9999999); and sending it SetLength(send_data, sizeof(packet)); send_data := RawToBytes(packet, SizeOf(packet)); udp.SendBuffer(make_it_big_endian(send_data)); <-- the question... "network byte order" or maybe I'm doing something wrong? I need to send "bign endian" packet pack(

Delphi How to get default value for property using RTTI

五迷三道 提交于 2019-11-28 10:35:25
问题 If I have a class like this: TServerSettings = class(TSettings) strict private FHTTPPort : Integer; published property HTTPPort : Integer read FHTTPPort write FHTTPPort default 80; end; How can I get the default attribute of the HTTPPort property using RTTI? 回答1: Like this: {$APPTYPE CONSOLE} uses System.TypInfo; type TMyClass = class strict private FMyValue: Integer; published property MyValue: Integer read FMyValue default 42; end; var obj: TMyClass; PropInfo: PPropInfo; begin obj :=

How to insert picture into TRichEdit in Delphi?

喜欢而已 提交于 2019-11-28 09:28:34
问题 I searched over internet for how to inserting picture in RichEdit . I only found inserting TImage into Richedit, or other 3rd part components to do it for me. I don't want to use other components or insert TImage into RichEdit. Is there any other way to do this? I want to insert it in line so I can use paragraph actions like justify on it (inserting TImage does not provide this as i found in examples and tested, am i wrong?). I want to write something like what happened in TJVRichEdit (in

What is the minimal agent install footprint for Delphi build automation?

霸气de小男生 提交于 2019-11-28 09:19:50
When creating a build server that does clean version control check-outs and full system builds of everything in a given source repository or project, what is the minimum required Delphi install footprint for XE3 Win32/Win64 projects? (Core system - not 3rd party components) I'd prefer to have a small subset of files that can be included in a repository rather than a full Delphi install. Arnaud Bouchez Using the command line compilers, you do not need to install the IDE on the remote agent computer. From a running installation, copy the \Bin and \Lib sub-folder content into your remote agent.

How to show the sort arrow on a TListView column?

时光怂恿深爱的人放手 提交于 2019-11-28 07:52:07
问题 Windows Explorer has an arrow indicating which column a list view (in report view style) is sorted by and in which direction (ASC vs. DESC). Is it possible to display such a sort indication arrow on a TListView in Delphi? 回答1: Here's some simple code to mark a header column as sorted ascending: uses Winapi.CommCtrl; var Header: HWND; Item: THDItem; begin Header := ListView_GetHeader(ListView1.Handle); ZeroMemory(@Item, SizeOf(Item)); Item.Mask := HDI_FORMAT; Header_GetItem(Header, 0, Item);

How to show data at Fast Report in 3*3 grid format?

北战南征 提交于 2019-11-28 06:52:28
问题 I want to display data from table (column :- ID) at FastReport in Grid format as shown below. Suppose there are 22 records in table then it would display same in 3 * 3 grid at FastReport in following manner. I am using subreport at main page inside MasterData1 band. At subreport MasterData band is as follows MasterData1 band TfrxReportPage1 - Columns 2 Subreport - MasterData2 properties Columns 3 , RowCount 9 But when I previewed fast report it is just repeating same data in each grid on page

How to display BLOB Image from database in the TAdvStringGrid with the help of DataSet

安稳与你 提交于 2019-11-28 02:17:45
问题 I have been making an application at Delphi XE3. I am trying to display values from database to the TAdvStringGrid component placed on the form. I am using dataset to display results at TAdvSTringGRid (code is given below). All other values are displaying perfectly except Image in database. Where it is expected to show image, it is showing junk characters. How to display image perfectly from DataBase at TAdvStringGrid. SQLConnection1: TSQLConnection; SQLMonitor1: TSQLMonitor; DataSource1:

How to hide firemonkey application button from Taskbar (XE4)?

╄→尐↘猪︶ㄣ 提交于 2019-11-28 02:06:19
问题 According to this question it is possible to hide fmx taskbar icon by changing window style to WS_EX_TOOLWINDOW . In XE2 and XE3 this code works: uses FMX.Platform.Win, Winapi.Windows; procedure TForm1.Button1Click(Sender: TObject); var h:THandle; begin h := FmxHandleToHWND(Handle); ShowWindow(h, SW_HIDE); SetWindowLong(h, GWL_EXSTYLE, GetWindowLong(h, GWL_EXSTYLE) or WS_EX_TOOLWINDOW); ShowWindow(h, SW_SHOW); end; In XE4 this solution does not work (application button should become hidden