delphi-7

TClientDataset ApplyUpdates error because of database table constraint

走远了吗. 提交于 2019-12-10 19:28:55
问题 I have an old Delphi 7 application that loads data from one database table, make many operations and calculation and finally writes records to a destination table. This old application calls ApplyUpdates every 500 records , for performances reasons. The problem is that, sometimes, in this bunch of records lies one that will trigger database constraint; Delphi fires an exception on ApplyUpdates . My problem is I don't know which record is responsible for this exception. There are 500

Dynamically loading exe file

拟墨画扇 提交于 2019-12-10 18:08:37
问题 I'm trying to dynamically load an exe file from my program and run SomeProcedure from that dynamicaly loaded exe. Here's what I'm doing in loaded exe - library.exe interface procedure SomeProcedure; stdcall; implementation procedure SomeProcedure; begin ShowMessage('Ala has a cat'); end; And here's my exe that load's library.exe and try to run SomeProcedure from it. type THandle = Integer; TProc = procedure(); var AHandle: THandle; Proc: TProc; procedure TForm1.Button1Click(Sender: TObject);

Delphi 7 - how to use Inputbox

强颜欢笑 提交于 2019-12-10 18:05:55
问题 I am programming a program where you have to enter a password into a InputBox to gain access to the programs min features . But I have a problem if you click on cancel on the inputbox my program gives a error message . So i wanted to know if any one know how I can get that right because with the Messagedlg I know you use IF . But how can I get it right with a InputBox ? 回答1: InputBox() returns a blank string if the dialog is canceled, eg: var Pass: String; Pass := InputBox('Password needed',

Delphi filling combobox items from SQL database [closed]

為{幸葍}努か 提交于 2019-12-10 16:59:02
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I want to fill my combobox with data from a SQL database but it doesn't work. My query has a connection to the database, query SQL property field is select * from provider_table Query1.SQL.Clear; Query1.SQL.Add('select name from provider_table where region_code = '+quotedstr('eng')'); Query1.Open; while NOT

Delphi7: Get attached monitor properties

旧巷老猫 提交于 2019-12-10 16:37:51
问题 How do I get my monitor's properties? I'm mostly interested in the manufacturer name and model type. I also don't want to get it from the registry. (Some PC's like my work PC has restricted access to the property key so I'd rather want to scan a system bus or something other than the reg.) Any ideas? Thanks SoulBlade 回答1: try using the Win32_DesktopMonitor WMI Class. this class have all the information wich you are looking. check this sample code. program GetWMI_MonitorInfo; {$APPTYPE CONSOLE

Implementing nsIProtocolHandler with Delphi

本小妞迷上赌 提交于 2019-12-10 16:26:13
问题 I'm trying to build an nsIProtocolHandler implementation in Delphi. (I've done an IInternetProtocol before with success, and want to have in FireFox what I've got in Internet Explorer.) Thanks to the d-gecko project, that somehow links the TInterfacedObject magic to the nsISupports magic, I'm able to make a DLL that provides an nsIModule when asked, which provides an nsIFactory when asked, which provides one of my nsIProtocolHandler's when asked, which provides one of my nsIChannel

Listbox content in another application

血红的双手。 提交于 2019-12-10 16:10:05
问题 How can i read a listbox items in another application's window? I could get the window's handle but i dont know a clear way to access components within. 回答1: You can try to get something from the following project, where is shown, how to enumerate child windows, filter them for a given class name and how to get the items of a list box. I would comment it, but this would be a long story, so please take it as a temporary post ... Unit1.pas unit Unit1; interface uses Windows, Messages, SysUtils,

How to Show bitmap image in Tspeedbutton when it is in disables state

孤街浪徒 提交于 2019-12-10 15:45:18
问题 I am dyanamically creating speedbuttons in tab change procedure, i want to made speed button disabled , when it is disabled it is not showing the loaded image. how to show the image on speed button when it is in disable state. I am using the code SpeedButton,SpeedButton.Glyph.LoadFromFile(Path) AND USING SpeedButton.numGlyphs =1 回答1: The image used in the Glyph can contain upto 4 images, one for each state of the SpeedButton (up, down, disabled, selected). The images are placed adjacent to

How to correctly use File Mapping and pass Data to a child process?

一世执手 提交于 2019-12-10 15:29:00
问题 My application is executing another process (" update.exe "), and I would like to pass large data (a Record maybe) from my app to the update program. Using command line to pass the data parameter(s) is not an option, because the data is too big (also Data size may vary). How to correctly create CreateFileMapping / MapViewOfFile / UnmapViewOfFile , then Executing my update.exe , finally Receiving the data in the update.exe program ( OpenFileMapping ), and freeing all handles (from main app and

Why do I get JPEG error 42 when it's stored in a database?

你。 提交于 2019-12-10 14:45:22
问题 I have problem to display my Picture in TImage from my MySql database using Delphi. I save picture to my database with this code and work Perfectly. var AStream : TMemoryStream; AStream := TMemoryStream.Create; try Image1.Picture.Graphic.SaveToStream(AStream); AStream.Position := 0; if ADODataSet1.Active then begin ADODataSet1.Edit; TBlobField(ADODataSet1.FieldByName('MyField')).LoadFromStream(AStream); ADODataSet1.Post; end; finally AStream.Free; end; But, problem is when I want to retrieve