Delphi

How to perform an image stream preview to a Delphi 6 frame or form from a background thread efficiently?

痞子三分冷 提交于 2020-01-14 12:36:23
问题 I have a Delphi 6 application that receives and processes an image stream from an external camera. I have the code on a background thread since it is CPU heavy and I don't want it interfering with with the user interface code that runs on the main thread. I want to update a rectangular area on a form or frame with the TBitmaps I create from the camera's JPEG frames that are received at a rate of 25 frames per second. I want to know what method will give me the best performance and what

Why Terminated property of thread is set?

五迷三道 提交于 2020-01-14 12:25:50
问题 I have multithread application. procedure TGridUpdater.Execute; begin inherited; CodeSite.Send('Thread executed'); sp := ConnectionFactory.GetConnection.LoadStoredProc('rab_itemData'); sp.CreateParam('Tahun', ftInteger, sppdInput).Value := _form.tahun; sp.Open; Synchronize(DoProgress1); sp.DataSet.First; I := 0; CodeSite.Send('Terminated value is ' + BoolToStr(Terminated)); //The terminated property is 'True' here. Why? while (not Terminated) and (not sp.DataSet.Eof) do begin CodeSite.Send(

Preventing “combining signed and unsigned types widened both operands” compiler warning

佐手、 提交于 2020-01-14 12:21:50
问题 This code, which is used to setup a component, produces a compiler warning: [DCC Warning] Unit1.pas(742): W1024 Combining signed and unsigned types - widened both operands var iPrecision: cardinal; iRadius: cardinal; iActive: boolean; iInProximity: boolean; iPrecision := Max(50, 100 - (3 + 2 * ord(iActive and iInProximity)) * iRadius); Can this be typecast somehow to prevent a compiler warning? 回答1: In your case, ord() returns an integer , so needs to be explicitely type-casted to cardinal ,

Why Terminated property of thread is set?

不想你离开。 提交于 2020-01-14 12:21:49
问题 I have multithread application. procedure TGridUpdater.Execute; begin inherited; CodeSite.Send('Thread executed'); sp := ConnectionFactory.GetConnection.LoadStoredProc('rab_itemData'); sp.CreateParam('Tahun', ftInteger, sppdInput).Value := _form.tahun; sp.Open; Synchronize(DoProgress1); sp.DataSet.First; I := 0; CodeSite.Send('Terminated value is ' + BoolToStr(Terminated)); //The terminated property is 'True' here. Why? while (not Terminated) and (not sp.DataSet.Eof) do begin CodeSite.Send(

Preventing “combining signed and unsigned types widened both operands” compiler warning

一世执手 提交于 2020-01-14 12:20:08
问题 This code, which is used to setup a component, produces a compiler warning: [DCC Warning] Unit1.pas(742): W1024 Combining signed and unsigned types - widened both operands var iPrecision: cardinal; iRadius: cardinal; iActive: boolean; iInProximity: boolean; iPrecision := Max(50, 100 - (3 + 2 * ord(iActive and iInProximity)) * iRadius); Can this be typecast somehow to prevent a compiler warning? 回答1: In your case, ord() returns an integer , so needs to be explicitely type-casted to cardinal ,

How to execute thread synchronize from a separate unit

坚强是说给别人听的谎言 提交于 2020-01-14 10:46:28
问题 I have the following problem/question. I have a unit named "myGlobalFunctions.pas". Inside this unit I have implemented multiple procedures/functions that are used by several projects. project 1 use this unit project 3 use this unit project 6 use this unit etc inside "project 1" there is a thread that use functions inside the "global function" unit. inside project 3 there is no thread but the functions are used. so far this thread (project1) provide almost no update of the application

How to get the name of the current user in delphi?

落花浮王杯 提交于 2020-01-14 10:42:33
问题 Hi there i am using delphi FM2 with XE3 in windows 8. The problem im having is that i want the user to press a button and then navigate to a subfolder located in appdata ex. C:\Users\Kobus\AppData\Roaming.minecraft Everybody has a diferant username so this wont work. So i use this code to get the username: function GetCurrentUserName : string; const cnMaxUserNameLen = 254; var sUserName : string; dwUserNameLen : DWord; begin dwUserNameLen := cnMaxUserNameLen-1; SetLength( sUserName,

How to get the name of the current user in delphi?

非 Y 不嫁゛ 提交于 2020-01-14 10:42:11
问题 Hi there i am using delphi FM2 with XE3 in windows 8. The problem im having is that i want the user to press a button and then navigate to a subfolder located in appdata ex. C:\Users\Kobus\AppData\Roaming.minecraft Everybody has a diferant username so this wont work. So i use this code to get the username: function GetCurrentUserName : string; const cnMaxUserNameLen = 254; var sUserName : string; dwUserNameLen : DWord; begin dwUserNameLen := cnMaxUserNameLen-1; SetLength( sUserName,

DLL issues and Invalid Memory Access

老子叫甜甜 提交于 2020-01-14 10:34:10
问题 So here is my situation. I am tasked with porting over part of a program from pascal written in a delphi IDE, at least I believe, to a Java program. I was not present at the creation of the program being ported over so I have almost no knowledge of the inner workings other than watching what it does as a final product. None-the-less, I have started transferring it over and hit a roadblock with their .dll calls. Their .dll calls are represented here: unit impdll; interface uses Classes,

Where can I specify an output folder for DLLs?

痴心易碎 提交于 2020-01-14 10:33:47
问题 I am confused a bit with a new RAD Studio version! Where can I specify a folder to put my output DLL files? 回答1: It is under Project | Options | Delphi Compiler. The option you are looking for is named Output Directory . The documentation says: Specifies where the compiler should put the executable file. You need to be careful about the various different targets. It's easy to modify the options for the release build, go back to the IDE, compile a debug build, and then wonder why your setting