Delphi

Delphi 7, TFileStream cant open files with special characters

孤街浪徒 提交于 2019-12-31 06:28:04
问题 This line: TFileStream.Create(fileName, fmOpenRead or fmShareDenyNone); drops an exception if the filename contain something like ñ 回答1: You are, ultimately calling CreateFileA , the ANSI API, and the characters you use have no ANSI encoding. The only way to get beyond this is to open the file with CreateFileW , the Unicode API. You might not realise that you call CreateFileA , but that's how the Delphi 7 file stream is implemented. One easy way to solve your problems is to upgrade to the

Destructor class in TObject and NIL Delphi

烈酒焚心 提交于 2019-12-31 05:36:07
问题 I am wondering why after I invoke Free method the object is not nil . What I mean for example next class: type Ta = class(TObject) public i: integer; destructor Destroy; override; end; destructor Ta.Destroy; begin inherited; end; procedure Form1.Button1; var a: Ta; begin a := Ta.Create; a.Free; if a = nil then button1.Caption := 'is assigned' else button1.caption := 'is not assigned'; end; My question is why after freeing the object is not nil and how will I make a to be nil after destructor

Move borderless form in Firemonkey

瘦欲@ 提交于 2019-12-31 05:34:13
问题 In VCL forms I use WM_SYSCOMMAND , but in firemonkey it is undeclared. I test this code: procedure TForm4.dragPanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin isDraging := true; X0 := X; Y0 := Y; end; procedure TForm4.dragPanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if isDraging then begin Form4.Left := Trunc(Form4.Left + X - X0); Form4.Top := Trunc(Form4.Top + Y - Y0); end; end; procedure TForm4.dragPanelMouseUp(Sender

Control panel Win7 applets

試著忘記壹切 提交于 2019-12-31 05:29:11
问题 In DelphiXe I create through the master of projects the new applet of the Control panel, I change an icon, the name, etc. To activation reactions I write Showmessage (' Test '); Compile, receive dll, rename in *.cpl. In a win.explorer at start of this file the message appears. In WinXp I insert this file in c:\windows\system32, open Control panel Windows, I see the applet and at its start the test message stands out. I make too most on Win7x64 (or on 2008r2), but in the control panel of the

Getting Cookie from TWebBrowser

左心房为你撑大大i 提交于 2019-12-31 05:09:58
问题 Trying to download a file using indy,(post to asp save the excel response) but running into errors, using wireshark the request is missing cookies. Trying to grab the cookie out of a Twebbrowser window and save it. procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); var document: IHTMLDocument2; cookies:tstringlist; begin cookies:=tstringlist.Create; document := WebBrowser1.Document as IHTMLDocument2; cookies.Add(document.cookie); //do stuff with them end; returns nothing, whats

Creating a proxy using sockets

ⅰ亾dé卋堺 提交于 2019-12-31 04:30:28
问题 I tried to write a proxy which passes traffic from 127.0.0.1:80 to 192.168.69.1:80 . This is my code: procedure TForm1.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket); var s: string; begin s := Socket.ReceiveText; clientsocket1.Open; clientsocket1.Socket.SendText(s); s := clientsocket1.Socket.ReceiveText; socket.SendText(s); socket.Close; end; procedure TForm1.FormCreate(Sender: TObject); begin ClientSocket1.Host := '192.168.69.1'; ClientSocket1.Port := 80; ClientSocket1

How to call the OnChange event of “Select” ? (Delphi - WebBrowser)

戏子无情 提交于 2019-12-31 04:05:53
问题 I'm using Delphi and WebBrowser componenet to navigate a html page . the page have a Combobox . is there any way to call the OnChange event ? The ComboBox is like this : <select name="comboname" onchange="Some Javascript codes"> Also , i have used this code : function TFrmMain.SetComboboxValue(WB: TEmbeddedWB; SelectName, ItemName: string): Boolean; var iForms, iFormItems, iSelectItems: Word; FormItem: OleVariant; begin Result := false; for iForms := 0 to WB.OleObject.Document.Forms.length -

Access remote database using DataSnap technology in C++ Builder 10.1 Berlin

会有一股神秘感。 提交于 2019-12-31 03:59:29
问题 How to query and get results from remote database using DataSnap technology in C++ Builder 10.1 Berlin ? I want to build a simple solution having two VCL Forms Applications, like client(1) and server(2), running on two different windows os computers, connected on same local network. But I cannot accomplish this simple task and this is what I tried to do: On the server application (2), I use: TSQLConnection *SQLConnection1; TSQLQuery *SQLQuery1; and I will load a SQLite database version 3: if

How to check if a service is running in Delphi 10 Seattle

雨燕双飞 提交于 2019-12-31 03:53:10
问题 The consensus (most votes) for Java developers seems to be private boolean isMyServiceRunning(Class<?> serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; } } return false; } But I am a Delphi developer working with 10 Seattle. I got this far in coding my function, and got stuck.

Problem with RadioGroup.ControlCount in Delphi 2010

独自空忆成欢 提交于 2019-12-31 03:44:47
问题 I'd like to set RadioButton properties in runtime in procedure InitRadioGroup(). It fails because RadioGroup.ControlCount is 0, although there are 3 RadioButtons in RadioGroup. What is wrong in D2010 RadioGroup? Same code works fine in Delphi 2007. procedure InitRadioGroup(RadioGroup: TRadioGroup); var i: integer; RadioButton: TRadioButton; begin for i := 0 to RadioGroup.ControlCount - 1 do begin RadioButton := (RadioGroup.Controls[i] as TRadioButton); RadioButton.ParentColor := False;