delphi-2010

Invalid variant type error Delphi 2010

扶醉桌前 提交于 2019-12-12 02:37:23
问题 // interface iccItem = class ID : String; DATA : Variant; constructor Create( _id : String; _data : Variant); end; iccDynamicObject = class private FItems : TList; function locate( _id : String) : iccItem; public constructor Create(); destructor Destroy(); override; public procedure define( _id : String; _dta : Variant); //function get( _ndx : DWORD) : Variant; overload;// link to original data function get( _id : String) : Variant; overload; public property Items[_id : String] : Variant read

How do I use a custom AVI with TAnimate?

丶灬走出姿态 提交于 2019-12-11 23:56:28
问题 I have an AVI file that I pulled from shell32 using Resources Extract. I would like to use this with TAnimate but I can't figure out how to load this file. I succesfully loaded the AVI into a .RES file using DelphiDabbler's rcdatacreator program (you have to download the "worked example" to get rcdatacreator. However, my issue now is figuring out how to extract the AVI file from the .RES and supplying it to TAnimate. I am using Delphi 2010: Any help is appreciated. 回答1: As Andreas mentioned

Check username/password in Active Directory from PC that is NOT part of domain

纵然是瞬间 提交于 2019-12-11 17:25:13
问题 Edit: I modified the code according to Andrei Galatyn's comment and hints that I shall not rely on token being nil when invalid, but it's still not working for PC's that are not part of the domain. I want to verify if a user entered a username/password combination that is valid in a LDAP server. Currently I use this code: function CheckWinUserAccount(Username, Password, Domain : string) : boolean; var token: THandle; begin result:=False; if LogonUser( PChar(Username), PChar(Domain), PChar

Anyone having problems with Delphi-2010 and Norton Internet Security 2010?

回眸只為那壹抹淺笑 提交于 2019-12-11 15:13:11
问题 I just spend the good part of the afternoon trying to find out why some projects, when compiled and run from within the Delphi-2010 IDE produced a 'Security Risk - A program is behaving suspiciously on your computer' warning every time I compiled it. In the end it turned out to be the following: - if version information is turned on 'Include version info in your project' - and you are including one of the Developer Express units (f.i. cxControls) than Norton Internet Security's sonor

How do I read a row from a file that has both numbers and letters in Delphi 2010?

柔情痞子 提交于 2019-12-11 15:03:38
问题 I have a text file that has, on any given row, data that are expressed both in text format and in numeric format. Something like this: Dog 5 4 7 How do I write a file reading routine in Delphi that reads this row and assigns the read values into the correct variables ("Dog" into a string variable and "5", "4" and "7" into real or integer variables)? 回答1: You can use SplitString from StrUtils to split the string into pieces. And then use StrToInt to convert to integer. uses StrUtils; .... var

Delphi : Variable used in the “for In” cannot be assigned!

谁都会走 提交于 2019-12-11 14:56:50
问题 Why is the assignment in the for...in loop disallowed by the compiler? procedure TForm1.Button1Click(Sender: TObject); Var ars : Array [0..10] of Integer; s : Integer; ct : Integer; begin ct := 0; for s in ars do Begin s := ct; // Does not compile! Inc(ct); End; End; 回答1: This is not supported, just as even simple loop iterator variables cannot be modified in a "normal" for loop. Even if this were supported in a for-in , it would not make much sense in this case. Integers are value types, so

Convert char pos of UnicodeString to byte pos in a utf8 string

久未见 提交于 2019-12-11 14:40:19
问题 I use Scintilla and set it's encoding to utf8 (and this is the only way to make it compatible with Unicode characters, if I understand it correctly). With this set up, when talking about a positions in the text Scintilla means byte positions. The problem is, I use UnicodeString in the rest of my program, and when I need to select a particular rang in the Scintilla editor, I need to convert from char pos of the UnicodeString to byte pos in a utf8 string that's corresponding to the

Why does my program hang between OnCloseQuery and FormDestroy events?

馋奶兔 提交于 2019-12-11 12:28:49
问题 I have a moderately complex program that uses several third party components that I have been maintaining for >20 years over many iterations of Borland/Codegear/Embarcadero IDE's. The latest iteration (using Delphi 2010) has a problem that appears only on some user's machines where it stops responding on shut down. If the user right clicks the Task Bar icon and selects "Close" again, the program will shut down. I have tried to reproduce the problem at my location without success. I have

xmpp - how i get notification when my friend logged in, he is in my roster list - delphi

瘦欲@ 提交于 2019-12-11 10:35:32
问题 after one day of searching and reading rfc's i haven't found any tip in this subject. i wrote delphi component to access openFire server and all steps until now is good, but i face one problem is: i have many friends in my roster list ,as example my Account Is "A@localhost" when account "B@localhost" logged in I haven't get any notification according to this. the "B" account is added in my roster list . Thanks in advance 回答1: XMPP presence is a mutual agreement; your friend must accept your

How to determine Windows Theme TColors

你离开我真会死。 提交于 2019-12-11 08:02:40
问题 I am emulating (to the degree possible) a TPopup Menu so it can float and users can drag it around. To do this, it's on its own form, and uses TPanels acting as if they are clickable TMenuItems. I'm using TPanels so I can change their color. To get the colors right, how can I determine at runtime (in Delphi 2010) the current theme's colors for TMenuItem.Color and TMenuItem.Font.Color (assuming such properties existed). TIA Edit I could use clBtnFace for the background, and clWindowText for