

JonRobertson
-
Content Count
289 -
Joined
-
Last visited
-
Days Won
7
Posts posted by JonRobertson
-
-
9 hours ago, Cristian Peța said:10 hours ago, Dalija Prasnikar said:For instance AI can say "Local variables are automatically initialized" and "Local variables are not automatically initialized" If you don't know which of those statements is true, you will not be in position to verify. You cannot even check with code, because local variable can accidentally occupy memory that was zero at the time, so it may seem like the first statement is true, while it is not.
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.
-
1
-
-
22 hours ago, David Schwartz said:Anything like that in just Delphi?
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:
TIEVisionFaceRecognizer
TIEVisionBarCodeScannerI 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.)
-
1
-
-
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
-
15 minutes ago, Kas Ob. said: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.
-
13 minutes ago, Kas Ob. said:Have you tried WM_GETTITLEBARINFOEX
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.
-
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
-
5 hours ago, silvercoder79 said:does SQL server suggest any indexes to add?
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.
-
2 hours ago, Celebr0 said:Dude, all the indentations are correct everywhere, I don’t know where you got the idea that they are incorrect?
Because only the TPyThread type definition was indented.
-
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:
Runtime/Designtime what? Delphi Packages
Component package - where to divide runtime, designtime, registration
-
41 minutes ago, Tom F said:Also, evaluate your SQL. Look at the execution plan, consider stored procedures, etc.
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.
-
2 minutes ago, dummzeuch said:What exactly is a "subprocess in python"? What does it do, if it is "more than DOS / command line stuff"?
Quoteyou can use the subprocess module to run a shell command, like "ls" or "ping", and get the output of that command in your Python code. You can also use it to run other Python scripts or executables, like .exe files on Windows.
That's why I asked when others suggested TDOSCommand. From the github page, it only mentions command line apps.
-
22 minutes ago, corneliusdavid said:DosCommand works great and is pretty easy to use--no need to get into the intricacies of CreateProcess.
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
-
8 minutes ago, dormky said:A search for TBitBtn just gave me 1842 results, and that's just the "main" part of the program. Now not all of these buttons have icons of course, but a significant portion does. We're talking at least hundreds of buttons to update and check here.
So no it's not every icon, but it's still a whole freaking lot.
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.
-
2 minutes ago, dormky said:Try to explain to management why we'd need so much time and testing to "make the icons grey"
Because every icon in a 1M line project would be affected?
-
4 hours ago, gioreva said:It is still telling me that they are missing:
BORLNDMM.DLL
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
-
1 hour ago, dummzeuch said:Turn off (remote) Debug symbols in the linker options, if it is turned on.
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.
-
4 hours ago, ToddFrankson said:Can Anyone else get to this website https://gis.cravencountync.gov/images/activebookings.html ?
I can from Windows 10. I don't have an iOS device to test.
-
-
5 hours ago, dummzeuch said:cnpack has a tool to remove unused units from the uses list
Unfortunately cnpack causes an AV in rtl*.dll when LiveBindings packages are disabled, and a couple other AVs in the IDE. I had to uninstall cnpack until this issue is resolved:
AV after exit RAD Studio 10.2.3 - 12.1
And hopefully this AV in coreide.bpl:
ifthen strange return value !
in Algorithms, Data Structures and Class Design
Posted
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.