delphi-7

OpenGL - render directly to bitmap

与世无争的帅哥 提交于 2019-12-09 06:38:00
问题 I am making an application that has a bunch of small windows and controls in it (2D rendering), and I would like to render each window and control to its own bitmap. This is what have so far: uses dglOpenGL; ... var BMP: TBitmap; DC, RC: HDC; ... function TMainForm.Init: Boolean; begin Result := InitOpenGL; if Result = True then begin BMP := TBitmap.Create; BMP.PixelFormat := pf24bit; BMP.Width := 1280; BMP.Height := 1024; DC := (BMP.Canvas.Handle); RC := CreateRenderingContext(DC, [opGDI,

Sending Keystroke to another application using WinAPI

核能气质少年 提交于 2019-12-09 04:27:20
问题 I have to control another application by sending keystrokes to it like CTRL S or CTRL SHIFT C or CTRL F . I've tried a lot of things, but I can't get it working. So I'm trying to get this right on a simpler case. This successfully sends Hey to the notepad: procedure TForm1.Button1Click(Sender: TObject); var notepad, edit: HWND; begin notepad := FindWindow('notepad', nil); edit := FindWindowEx(notepad, FindWindow('Edit', nil), nil, nil); SendMessage(edit, WM_CHAR, dword('H'), 0); SendMessage

XPath in Delphi7?

﹥>﹥吖頭↗ 提交于 2019-12-09 03:34:22
问题 What is the best way of searching XML documents using XPath in Delphi7? 回答1: It depends on the size of the xml document. But I have good experience with both MSXML and its Saxon counterpart. If the xml is large (>50 MB) or the queries are heavy (use some // to make your system crawl) expect some delay time. But else it is perfectly doable. In later versions, msxml is available as a unit. In version 7 you need to install a type library: Go to Project\Import type library Select Microsoft XML,

Get the offset of a field in a delphi record at runtime

烈酒焚心 提交于 2019-12-08 21:05:37
问题 Given a record type: TItem = record UPC : string[20]; Price : Currency; Cost : Currency; ... end; And the name of a field as a string , how can I get the offset of that field within the record? I need to do this at runtime - the name of the field to access is decided at runtime. Example: var pc : Integer; fieldName : string; value : Currency; begin pc := Integer(@item); // item is defined and filled elsewhere fieldName := Text1.Text; // user might type 'Cost' or 'Price' etc Inc(pc,

GetStackTrace in Delphi 7?

巧了我就是萌 提交于 2019-12-08 15:45:07
问题 Using Delphi 7, how can I get a string representing the stack-trace from an Exception ? try SomethingDodgy(); except on E:Exception do begin // print stack trace Log.Write(/* ??? */); end; end; I hear there's a GetStackTrace function in the latest delphi, but I can't find anything for delphi 7. No, upgrading is not an option :) 回答1: You could try using madExcept, a wonderful Exception handling framework. madshi has heaps of sample code in there; I'm sure I've used the stack-trace stuff in

Recreating a TThread Inside a TThread dervied class

拜拜、爱过 提交于 2019-12-08 14:00:20
问题 I created a new class derived from TThread class, and on the constructor i call "inherited Create(True);", and then call "Resume()" since i have override the Execute() call, now i wanna recall the Execute() (Run the Thread Again) without destroying the class instance, so i have a function inside the new class called "myRestart()", which recalls "inherited Create(True);" and makes me able to call "Resume()" again and thread works again. my question is, is this a safe practice? will it work

delphi 7 http request into string

浪子不回头ぞ 提交于 2019-12-08 13:57:38
问题 I want to load a url directly into a string without any data stream,what is the best way, internet open url works but it seems not clear. I don't want to use any component for reading some short messages 回答1: Delphi 6 and later ship with Indy, which has a TIdHTTP client component, eg: uses ..., IdHTTP; var Reply: String; begin Reply := IdHTTP1.Get('http://test.com/postaccepter?=msg1=3444&msg2=test'); ... end; Or: uses ..., IdHTTP; var Reply: TStream; begin Reply := TMemoryStream.Create; try

Please explain package use

自古美人都是妖i 提交于 2019-12-08 13:12:29
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 suspect are terminal (that is, for packages A.B.C I have a uses C clause). Can I add one statement somewhere

Delphi 7 remobjects - serialize a component

谁说我不能喝 提交于 2019-12-08 12:41:19
问题 I have a client-server application built in Delphi 7 and RemObjects SDK. Messages between client and server are binary (http://wiki.remobjects.com/wiki/BinMessage). My questions are: 1) if I fill with data a TDataSet/TDataSource and sent them from client to server, on the server component's DataSet will contain the data? the data should remain persistent no? 2) I've tried to send the component through RemObjects, encapsulated in a TROBinaryMemoryStream descendant class, but without succes

Checking safety of Delphi DLL to use in C#

微笑、不失礼 提交于 2019-12-08 12:07:02
问题 I have a DLL which takes care of custom drawing for some special glass effects. I'm putting it in a DLL for three reasons: 1) So it can be easily re-used and distributed of course without weighing its host app down, 2) So I can distribute it to developers without them knowing how it works, and 3) So it can be used from C#. It currently works in Delphi, but I know I will need to do many changes to make it support C#. For example, the main DLL function includes 1 parameter (a Record) which