Delphi

TFDQuery.Prepare cannot determine parameter types for INSERT query on MS SQL SERVER

旧时模样 提交于 2020-01-10 04:36:27
问题 I open a TFDConnection for MS SQL Server with parameters: DriverID=MSSQL Password=test User_Name=test Server=VS2003-2008 Database=test Single Connection=TRUE Max Cursors=256 USE OLEDB=TRUE I then create a TFDQuery (run time), set its connection to the above, fill it with an parameterized INSERT query: insert into TT_ACT (TT_ACT_ID,TT_PARENT_ID,TT_FROMDATE,TT_TODATE,TT_NAME,TT_NR,TT_CODE,TT_GROUP...) values (:TT_ACT_ID,:TT_PARENT_ID,:TT_FROMDATE,:TT_TODATE,:TT_NAME,:TT_NR,:TT_CODE,:TT_GROUP,..

How to Search a File through all the SubDirectories in Delphi

两盒软妹~` 提交于 2020-01-10 04:24:05
问题 I implemented this code but again i am not able to search through the subdirectories . procedure TFfileSearch.FileSearch(const dirName:string); begin //We write our search code here if FindFirst(dirName,faAnyFile or faDirectory,searchResult)=0 then begin try repeat ShowMessage(IntToStr(searchResult.Attr)); if (searchResult.Attr and faDirectory)=0 then //The Result is a File //begin lbSearchResult.Items.Append(searchResult.Name) else begin FileSearch(IncludeTrailingBackSlash(dirName)

Named threads in Delphi - what is that for?

我怕爱的太早我们不能终老 提交于 2020-01-10 04:01:24
问题 When you create a TThread descendant using the tool palette in your BDS, you can provide a name for the thread. Here's the auto-generated code. You just call the SetName() function in the Execute method and the thread calling this method is given a name in a kind of weird way... {$IFDEF MSWINDOWS} type TThreadNameInfo = record FType: LongWord; // must be 0x1000 FName: PChar; // pointer to name (in user address space) FThreadID: LongWord; // thread ID (-1 indicates caller thread) FFlags:

Can Delphi only use a .dll if required?

烈酒焚心 提交于 2020-01-10 03:59:25
问题 I have added these two methods to the 1st unit of my Delphi 5 application. function Inp(PortAddress: Integer): Integer; stdcall; external 'inpout32.dll' name 'Inp32'; procedure Output(PortAddress, Value: Integer); stdcall; external 'inpout32.dll' name 'Out32'; However I don't want to have to issue the inpout32 library with the software unless they explicitly need it. Currently the program says "Not Found" upon executing unless they're present in the root or System32. Users will only call

How to track down tricky memory leak with fastMM?

霸气de小男生 提交于 2020-01-10 02:55:47
问题 After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown memory leak, so far I've been tryin to track it down using fastMM, here is what fastMM stack trace reports: A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace (return addresses) at the time was: 40339E [System.pas][System][@GetMem][3412] 534873 [crtl][_malloc] 56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918] 56D316 [canex.cpp][MidasLib]

Correct way to duplicate Delphi object

為{幸葍}努か 提交于 2020-01-09 12:52:12
问题 What are pros and cons of duplication an object instance with constructor or instance function? Example A: type TMyObject = class strict private FField: integer; public constructor Create(srcObj: TMyObject); overload; //alternatively: //constructor CreateFrom(srcObj: TMyObject); property Field: integer read FField; end; constructor TMyObject.Create(srcObj: TMyObject); begin inherited Create; FField := srcObj.Field; end; Example B: type TMyObject = class strict private FField: integer; public

Recompiling the RTL - if possible, then how?

谁都会走 提交于 2020-01-09 12:51:51
问题 I have this craving to do some experiments with modifying the underbelly of the Delphi run time library (RTL), system.pas and the likes... It is possible or not? I'm very fond of challenges like "yes, but you'll have to provide custom .obj files for some assembler wizardry because they were never distributed with the official Delphi source". Fine with me, I just want to know. I want to do this experiment with Delphi 7, but inside information on any other version is fine. It is one of the

SuperObject cannot handle null string

六月ゝ 毕业季﹏ 提交于 2020-01-09 11:24:11
问题 Some JSON serializers return null for an empty string datafield, e.g. { "searchtext": null, "moretext": "contains something", "bookdate": 1377468000000, "empid": 12345, "listtype": 1 } I'm using SuperObject to create a ISuperObject: var FJSONRequest: ISuperObject; then FJSONRequest := SO(Request.Content); // Webservice request This returns an object with a string containing the text 'null' . Obviously this is because SuperObject does not care about the quotes ( "searchtext": a gives the same

SuperObject cannot handle null string

独自空忆成欢 提交于 2020-01-09 11:24:01
问题 Some JSON serializers return null for an empty string datafield, e.g. { "searchtext": null, "moretext": "contains something", "bookdate": 1377468000000, "empid": 12345, "listtype": 1 } I'm using SuperObject to create a ISuperObject: var FJSONRequest: ISuperObject; then FJSONRequest := SO(Request.Content); // Webservice request This returns an object with a string containing the text 'null' . Obviously this is because SuperObject does not care about the quotes ( "searchtext": a gives the same

Error on LoadURL with TChromium

岁酱吖の 提交于 2020-01-09 10:51:33
问题 I found the brilliant Delphi Chromium project for embedding Chrome in a Delphi form. It works well in Delphi7 after a bit of hacking and I can get the demo app running. However when I do my own app with the component, I can't load my own url. I get a access violation. Chromium2.Browser.MainFrame.LoadUrl('http://www.example.com'); The TChromium component is working and I have all the DLLs in the right place, since if I set DefaultUrl it works fine. I have Chromium2 in a TPageControl page and