

JonRobertson
Members-
Content Count
289 -
Joined
-
Last visited
-
Days Won
7
Everything posted by JonRobertson
-
ifthen strange return value !
JonRobertson replied to bravesofts's topic in Algorithms, Data Structures and Class Design
Ah, yes. My apologies. That is a valid point. -
ifthen strange return value !
JonRobertson replied to bravesofts's topic in Algorithms, Data Structures and Class Design
Did the tone of this conversation lean towards mockery or belittling the person asking the question, or am I mistaken? You are mistaken. I've been coding for 43 years and I don't read assembler. I know what a *few* x86 instructions do. But not enough to look at a disassembled function and determine what the code does. At least, not without spending a LOT of time trying to figure it out. -
ifthen strange return value !
JonRobertson replied to bravesofts's topic in Algorithms, Data Structures and Class Design
Assembler of that code will show the truth... but I think that someone that ask such things do not have ability to read assembler. Disassembled code would reveal the code generated by the compiler. But it isn't going to reveal the contents of memory (registers, stack, or heap) prior to the code even executing. As Dalija points out, I could execute it once and the memory was zero at the time and execute it a thousand more times and the memory has values aside from zero. -
how to recognize cards drawn from a deck?
JonRobertson replied to David Schwartz's topic in General Help
You may want to look at ImageEn. Although this is a commercial library, it has been developed for decades, currently maintained, and extremely well supported. It offers several ways to recognize objects in images. One is an integration with Google Vision, TIEGoogleVision. The others require the IEVision add-on: TIEVisionImage.matchTemplate TIEVisionObjectsFinder TIEVisionNNet.detectObjects TIEVisionBlobDetector TIEVisionFaceRecognizer TIEVisionBarCodeScanner I have no affiliation with ImageEn, aside from being a happy customer & user of ImageEn components. (I have no experience with the IEVision components referenced above.) -
Best option for events with different parameter type in each child class?
JonRobertson replied to Dmitry Onoshko's topic in Algorithms, Data Structures and Class Design
Perhaps something like this? type TFooMessage = class Foo: Integer; end; TBarMessage = class Bar: Double; end; TCustomProtocol<T> = class(TPersistent) private FMsg: T; FOnMsg: TProc<T>; published property OnMsg: TProc<T> read FOnMsg write FOnMsg; end; TFooProtocol = class(TCustomProtocol<TFooMessage>); TBarProtocol = class(TCustomProtocol<TBarMessage>); -
I want to create a window that looks and performs similar to the IDE Insights search results. Using IDE Explorer, I suspect that window is TIDEInsightForm and uses a Virtual TreeView component for the search results. Does anyone know if that is correct? Thanks
-
I have very little experience with changing UI at the Windows message level. I am hoping someone can explain a behavior that is confusing to me. The purpose of my question is strictly educational. In the attached demo project, WM_NCCALCSIZE attempts to change the form's client area to the entire form, without the caption bar. Decreasing NCCalcSizeParams.rgrc[0].Top by 31 (scaled if needed) does what I expect: Using a value of 30 gives me this: In the second example, Windows does not recognize the caption bar as part of the window. For example, clicking in that area sends the mouse click message to the window under my form. That makes sense to me. What I don't understand is why changing the value that I decrease from .Top from 30 to 31 makes such a difference in whether the painted client area "includes" the caption bar, for lack of a better description. I would expect values between 1 and 30 to gradually hide (?) the caption bar, rather than all or nothing. I also have not figured out how to determine that 31 is the value needed to accomplish the first image. I've tried various system metrics values such as SM_CYCAPTION, SM_CYFIXEDFRAME, and SM_CYDLGFRAME. Even combining SM_CYCAPTION with one of the SM_CY*FRAME values results in a value that is too small. My current interest is in a non-themed or Windows themed application. I have looked at TFormStyleHook.WMNCCalcSize to see how the VCL handles WM_NCCalcSize when themed. But that didn't help me understand the behavior that I'm seeing without themes. Thanks WMNCCalcSize.zip
-
Looking for some guidance on WM_NCCALCSIZE
JonRobertson replied to JonRobertson's topic in Windows API
Nice. I spent several hours searching for answers over the weekend and did not come across that calculation. I completely overlooked SM_CXPADDEDBORDER. That answers the question of how to determine the value to use. This works for me: procedure TfrmMain.WMNCCalcSize(var Message: TWMNCCalcSize); begin inherited; var captionHeight := GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXPADDEDBORDER); var Scale := RoundTo(CurrentPPI / Screen.DefaultPixelsPerInch, -2); var NCCalcSizeParams := Message.CalcSize_Params; Dec(NCCalcSizeParams.rgrc[0].Top, Round(captionHeight * Scale)); end; Does anyone know why using a value of one less than captionHeight results in the entire caption bar being painted? Thanks again. -
Looking for some guidance on WM_NCCALCSIZE
JonRobertson replied to JonRobertson's topic in Windows API
No, I didn't know about that Windows message. So I learned something today. The rcTitleBar.height coming back from WM_GETTITLEBARINFOEX is 23, which is the same value that I get from GetSystemMetrics(SM_CYCAPTION). Unfortunately that is not high enough to get the behavior that I'm expecting. Oddly (to me), the height for the various min/max/close buttons comes back as 24. -
Looking for Advice on Improving the Performance of Delphi Applications
JonRobertson replied to Andro12's topic in Tips / Blogs / Tutorials / Videos
Don't blindly accept suggestions for indexes from SQL Server. Those would help that one query but may only help that query. You also have to consider the database write and maintenance cost of each index. -
Because only the TPyThread type definition was indented. https://en.delphipraxis.net/topic/11903-each-py-script-in-a-separate-window/?do=findComment&comment=93799
-
Loading and Saving PNG into TBitmap changes the image
JonRobertson replied to XylemFlow's topic in FMX
Deleted invalid reply that was VCL specific. -
Assuming that the code for your component is already in a package, right-click on the package in the Projects window and select the Install menu item: The documentation that you referenced is lacking. If your component directly interacts with the Delphi IDE, such as using any of the Design*.pas units in the $(BDS)\Source\ToolsAPI folder, then you need to separate your design-time specific code from your run-time code and have separate design-time and run-time packages. Here are some links that may be helpful. Search engines are your friend: Creating Packages Runtime/Designtime what? Delphi Packages Component package - where to divide runtime, designtime, registration
-
Looking for Advice on Improving the Performance of Delphi Applications
JonRobertson replied to Andro12's topic in Tips / Blogs / Tutorials / Videos
And look at any code in events that may be accessing the underlying data source or server. For example, there are events that will fire as you scroll through the data shown in a db grid. If your grid, dataset, or datasource components have events connected, those will slow down the performance of using the grid. -
Your app may need elevated rights to kill the process. There are processes that cannot be killed via Task Manager, even when it is elevated. Some other apps (possibly Process Explorer or another utility from Sysinternals) are more aggressive and successful at killing processes. There are many system services cannot be killed and that would include any child processes that those services launch. Have you confirmed which techniques are able to kill this process, outside of writing your own code? That will be necessary to determine which approach would work for your code. If you haven't, I highly recommend determining what is launching the process and what it is doing, using another utility such as Process Monitor from Sysinternals. I have a strong dislike for background processes that consume CPU, I/O, or memory resources. But I research what they are doing and how they were launched to determine whether they are really needed or safe to disable.
-
What is Python Subprocess That's why I asked when others suggested TDOSCommand. From the github page, it only mentions command line apps.
-
Python's subprocess does more than DOS / command line stuff. How well does TDOSCommand work with Windows executables?
-
There is also TProcess, ported from Lazarus lcl. I've never used it and the last update was 7 years ago. I suspect most Delphi developers use CreateProcess, as long as the project is Windows only. See Darian's link above. Here are a few others: https://www.delphibasics.info/home/delphibasicssnippets/createprocessandwaitforexit http://www.delphicorner.f9.co.uk/articles/wapi4.htm https://riptutorial.com/delphi/example/18340/createprocess
-
You can also search for Glyph.Data in the DFM files. There are components other than TBitBtn that have a Glyph property, but each of those should (I think) be a visual component that has an image stored in the component that would be displayed in the app. I agree with others that you should either replace TBitBtn with a component that accomplishes your goal or switch to using either an image list or TImageCollection and TVirtualImageList. The later would be a better investment of the time required. You may also want to look at High DPI Image List Support.
-
Because every icon in a 1M line project would be affected?
-
BORLNDMM.DLL should only be needed if an EXE or DLL Delphi project has ShareMem in the project's uses clause (in the .dpr file). If that is needed and you are on a recent version of Delphi, replace ShareMem with SimpleShareMem. Related documentation is at https://docwiki.embarcadero.com/RADStudio/Athens/en/Sharing_Memory
-
Or set the options to put debug info in a separate file to be able to use a debugger without having the debug info in the EXE. The image below is Delphi 11.3. The option may be named or placed differently in various versions of Delphi.
-
Which libraries are you referring to? If you mean the Delphi Run Time Library, bundled VCL or FMX components, and third-party components, then Delphi builds a standalone EXE by default. There is an option to use run-time packages, which reduce the size of your EXE but require distributing those packages with your EXE: If you are referring to libraries that are not Delphi/Object Pascal code, then you need to be more specific with your question.
-
I can from Windows 10. I don't have an iOS device to test.
-
Where can I find the official version numbers of the embarcadero products?
JonRobertson replied to Mr. E's topic in General Help
I don't remember the specifics, but there was some legislation in the U.S. that restricted what a publicly owned software company could release as a "patch" or fix versus an update.