delphi-7

Delphi: TImage.Create causes Access violation

。_饼干妹妹 提交于 2019-12-31 00:58:11
问题 I apologize in advance for a newbie question, but why do I get "Access violation" error with the code below (on the "Create(SelectorForm);" line)? I tried using the main form as the owner, but it didn't make any difference. var SelectorForm: TSelectorForm; ArrayOfImages: Array [1..10] of TImage; implementation procedure TSelectorForm.FormCreate(Sender: TObject); var Loop: Byte; begin for Loop := 1 to 10 do begin with ArrayOfImages[Loop] do begin Create(SelectorForm); end; end; end; 回答1: The

How to determine if all characters in a string are equal

喜夏-厌秋 提交于 2019-12-30 09:43:15
问题 I need to know if all characters in a string are equal (formed by the same character). the function must return true or false depending if all the elements of the string are equal to an particular char. I wrote this function that works well, but I'm looking for a more optimal (fastest) solution, the strings can have thousands of chars. function AllElementsAreEqual(Element:Char;Str:String):Boolean; var i : Integer; begin Result:=True; if Str<>'' then for i:=1 to Length(Str) do if Str[i]<

Unexpected Thread behaviour calling Delphi DLL

∥☆過路亽.° 提交于 2019-12-30 07:05:23
问题 Continue from my other question: How do I pass and retrieve memory stream from my Application to/from DLL? I have wrote the DLL using IStream as input/output. The DLL uses IXMLDocument (which at first I thought was related to the follow problem) Tested it, and it worked well in the main UI. Problems began when I was calling the DLL from a worker thread. The DLL: library MyDLL; uses Windows, Variants, SysUtils, Classes, AxCtrls, ActiveX, XMLDoc, XMLIntf; {$R *.res} procedure Debug(V: Variant);

Unexpected Thread behaviour calling Delphi DLL

隐身守侯 提交于 2019-12-30 07:04:43
问题 Continue from my other question: How do I pass and retrieve memory stream from my Application to/from DLL? I have wrote the DLL using IStream as input/output. The DLL uses IXMLDocument (which at first I thought was related to the follow problem) Tested it, and it worked well in the main UI. Problems began when I was calling the DLL from a worker thread. The DLL: library MyDLL; uses Windows, Variants, SysUtils, Classes, AxCtrls, ActiveX, XMLDoc, XMLIntf; {$R *.res} procedure Debug(V: Variant);

Unexpected Thread behaviour calling Delphi DLL

戏子无情 提交于 2019-12-30 07:04:27
问题 Continue from my other question: How do I pass and retrieve memory stream from my Application to/from DLL? I have wrote the DLL using IStream as input/output. The DLL uses IXMLDocument (which at first I thought was related to the follow problem) Tested it, and it worked well in the main UI. Problems began when I was calling the DLL from a worker thread. The DLL: library MyDLL; uses Windows, Variants, SysUtils, Classes, AxCtrls, ActiveX, XMLDoc, XMLIntf; {$R *.res} procedure Debug(V: Variant);

Persistent Objects in Windows XP/Delphi 7

我的未来我决定 提交于 2019-12-30 06:56:07
问题 I am trying to make an AlarmSystem in Delphi 7, Windows XP. I have to register alarms in a Database (MS SQL Server 2000). But what if the server is down??? Well, I can imagine that I have to persist objects of TAlarm type. So, how can I do this? Maybe inheriting from TComponent??? Please, how can I do this?? Thanks a lot. I am sorry about my English. Here you have more info... TAlarm is a class that descends from TObject, basically. There are 10 more classes that descend from TAlarm (some

SQL query with variables

跟風遠走 提交于 2019-12-30 05:26:09
问题 Hey guys I need help with this please... I am doing a PAT for school and I am doing the following how can I correct it... I want to send an entered email address , name , Id number , birth date , gender , town and all is string my statement is Adoquery1.sql.text := 'insert into besprekings values('email', 'name', 'Id', 'birth', 'gender', 'town')'; The fields are as follows: Email(string), Name(string), ID(string), Birth(string), Gender(string), town(string) This is not really homework it is a

Calling functions from a c++ DLL in Delphi

纵饮孤独 提交于 2019-12-30 04:02:33
问题 I created a new c++ DLL project in VS2010 that exposes 1 function #include "stdafx.h" #define DllImport extern "C" __declspec( dllimport ) #define DllExport extern "C" __declspec( dllexport ) DllExport int DoMath( int a, int b) { return a + b ; } I then created a C++ application with VS2010 to test this DLL. The test application build in VS2010 could call the c++ DLL and get the expected result. #include "stdafx.h" #include <windows.h> typedef int (*DoMath)(int, int) ; int _tmain(int argc,

Is there a benefit in using old style `object` instead of `class` in Delphi?

≯℡__Kan透↙ 提交于 2019-12-30 03:11:09
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find

Is there a benefit in using old style `object` instead of `class` in Delphi?

假装没事ソ 提交于 2019-12-30 03:11:03
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find