-
Content Count
2777 -
Joined
-
Last visited
-
Days Won
98
Everything posted by dummzeuch
-
Just in case anybody else is wondering: This works since Delphi 2010 which was the version that first included the unit rtti. Older Delphi versions did not support RTTI for records.
-
"Abort" is a popular name for procedures and methods, that's why it came to mind. I had to qualify it several times in my code because there was an ambiguity. I'm too lazy to use that qualifier without a good reason. Uwe's answer looks like a good solution for these cases. I hope I remember it the next time this comes up.
-
You can have a lot of fun when starting to use namespaces. This compiles fine ... unit bla; uses SysUtils; interface implementation procedure Test; begin SysUtils.Abort; end; ... until you add the namespace to the unit name ... unit bla; uses System.SysUtils; interface implementation procedure Test; begin SysUtils.Abort; end; ... but do you really want to write System.SysUtils.Abort ? This is just an example. You don't of course need to qualify Abort, but if there are name clashes in different units you have to, or you can rely on the order of the units in the uses clause, which I think is a bad idea.
-
Actually, the concept of namespaces was introduced with Delphi 2005, but the RTL and VCL started using them much later. A quick search in my installations found vcl.controls.pas appearing in Delphi XE2, before that it was just controls.pas
-
YMMD: I just imagined the developers singing while running the signing process.
-
Is it possible to hide the Object Inspector automatically when the Design tab is showing?
dummzeuch replied to Gord P's topic in Delphi IDE and APIs
You could have different desktops for these "modes", but they won't switch automatically either. Hm, maybe you could assign keyboard shortcuts to these menu entries using GExperts, but I'm not sure this is possible. Edit: It isn't. The menu entries for the configured desktops are added dynamically and don't show up in the GExperts IDE Menu Shortcuts expert. So you can't assign a keyboard shortcut to them. (At least not this way). -
The current source code compiles fine in Delphi 12.2 and I haven't noticed any new bugs. The Installer for Delphi 12.1 works for Delphi 12.2. I haven't heard of any problems there either.
-
I have just built an installer for GExperts 1.3.24 Beta1 for Delphi 12. Note the word “Beta” in the release name! We are one step up from Alpha, there are still many bugs, but overall it seems to be stable. Most of the bugs manifest themselves as display glitches on high DPI monitors. Continue reading in the blog post
-
Only 2 GB available despite IMAGE_FILE_LARGE_ADDRESS_AWARE
dummzeuch replied to dummzeuch's topic in Windows API
I got it from some random 😉 post on StackOverflow (I could not find it on any Microsoft site) -
The Win32 Delphi 2007 program below sets the PEFlag for IMAGE_FILE_LARGE_ADDRESS_AWARE, so I would expect it to have 3 GB of memory available. But it writes: TotalVirtual 2147352576 Bytes 2,000 GiB AvailVirtual 2093465600 Bytes 1,950 GiB So why does it say there are only 2 GB? The OS is Windows 10 pro 64 Bit with 16 GB of physical memory (from which a lot is available). I could have sworn that this has worked before. Edit: Duh! I forgot an 'or' between 'IMAGE_FILE_NET_RUN_FROM_SWAP' and 'IMAGE_FILE_LARGE_ADDRESS_AWARE' program Project1; {$APPTYPE CONSOLE} uses Windows, SysUtils; {$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP IMAGE_FILE_LARGE_ADDRESS_AWARE} procedure GetProcedureAddress(var P: Pointer; const ModuleName, ProcName: string); var ModuleHandle: HMODULE; begin if not Assigned(P) then begin ModuleHandle := GetModuleHandle(PChar(ModuleName)); if ModuleHandle = 0 then begin ModuleHandle := SafeLoadLibrary(PChar(ModuleName)); if ModuleHandle = 0 then raise Exception.CreateFmt('Library %s not found', [ModuleName]); end; P := GetProcAddress(ModuleHandle, PChar(ProcName)); if not Assigned(P) then raise Exception.CreateFmt('Function %s not found in library %s', [ProcName, ModuleName]); end; end; type _MEMORYSTATUSEX = packed record dwLength: DWORD; dwMemoryLoad: DWORD; ullTotalPhys: Int64; ullAvailPhys: Int64; ullTotalPageFile: Int64; ullAvailPageFile: Int64; ullTotalVirtual: Int64; ullAvailVirtual: Int64; ullAvailExtendedVirtual: Int64; end; {$EXTERNALSYM _MEMORYSTATUSEX} MEMORYSTATUSEX = _MEMORYSTATUSEX; {$EXTERNALSYM MEMORYSTATUSEX} LPMEMORYSTATUSEX = ^_MEMORYSTATUSEX; {$EXTERNALSYM LPMEMORYSTATUSEX} TMemoryStatusEx = _MEMORYSTATUSEX; type TGlobalMemoryStatusEx = function(out lpBuffer: TMemoryStatusEx): BOOL; stdcall; var _GlobalMemoryStatusEx: TGlobalMemoryStatusEx = nil; function GlobalMemoryStatusEx(out lpBuffer: TMemoryStatusEx): BOOL; stdcall; begin GetProcedureAddress(Pointer(@_GlobalMemoryStatusEx), kernel32, 'GlobalMemoryStatusEx'); Result := _GlobalMemoryStatusEx(lpBuffer); end; function GetTotalMemInfo: string; var MemStatusEx: TMemoryStatusEx; begin MemStatusEx.dwLength := SizeOf(MemStatusEx); if GlobalMemoryStatusEx(MemStatusEx) then begin Result := Format('TotalVirtual %d Bytes %.3f GiB', [MemStatusEx.ullTotalVirtual, MemStatusEx.ullTotalVirtual / 1024 / 1024 / 1024]); Result := Result + #13#10 + Format('AvailVirtual %d Bytes %.3f GiB', [MemStatusEx.ullAvailVirtual, MemStatusEx.ullAvailVirtual / 1024 / 1024 / 1024]); end else begin Result := 'GlobalMemoryStatusEx call failed'; end; end; begin try WriteLn(GetTotalMemInfo); Readln; except on E: Exception do WriteLn(E.ClassName, ': ', E.Message); end; end.
-
Only 2 GB available despite IMAGE_FILE_LARGE_ADDRESS_AWARE
dummzeuch replied to dummzeuch's topic in Windows API
Just in case anybody is still reading: I found some code in my program that didn't work once the 2 GB limit was reached. "Fortunately" it was where a DLL was loaded into memory near the start of the execution so it never happened until I configured Windows to start allocating memory from top using the registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management AllocationPreference= 0x100000 Then all of a sudden it crashed. I fixed this problem now (I hope). It was in dzlib library, unit u_dzResourceDllLoader, btw. so if somebody else is actually using that library, you might want to update. -
It doesn't really make much sense to use the old Delphi 12.1 bpls with programs compiled in Delphi 12.2.
-
It moved to its own expert and I blogged about that change. And I also answered that question in the second post of this thread.
-
Interesting concept. Thanks for sharing it. I have never heard about this unit before, but I found this page by googling for "TInputRecArray" "Delphi" which looks a lot like your unit. It's a blog post from 2013 on a Chinese site. I think the concept could be improved on by using fluid programming like this: var Value1, Value2, Value3: Variant; // ... Success := MultiInputBox(Self) .AddField('Enter your age.: ' , 3, ftNumber, 0, Value1) .AddField('Enter a hex value.: ', 4, ftHexNumber, 0, Value2) .AddField('Enter a float value.: ', 10, ftFloatNumber, Value3) .ShowModal; That could be done by having MultiInputBox return an interface with an AddField function that returns that interface and a ShowModal function that returns the boolean. That interface then internally declares and manages the TInputRecArray. This saves the boilerplate code of declaring and filling the TInputRecArray and make the code (in my opinion) a lot more readable.
-
Watch me coding in Delphi on YouTube
dummzeuch replied to silvercoder79's topic in Tips / Blogs / Tutorials / Videos
GExperts did not have a Code Formatter in the 90ies. There was only DelForEx by Egbert van Nees (and later a code formatter as part of project JEDI which today is part of the Lazarus IDE). He donated that code to GExperts in the mid 2000ties and I integrated it into GExperts and over the years improved it (performance on large files more than doubled) and extended it to cover new language constructs that were added. -
Difficulty with XKeys PIEHid32.dll in Delphi 10 Seattle
dummzeuch replied to Vitor Domingos's topic in General Help
see private message -
Difficulty with XKeys PIEHid32.dll in Delphi 10 Seattle
dummzeuch replied to Vitor Domingos's topic in General Help
I just had a look at my import unit. It also uses stdcall, so that's not the problem. I apparently wrote a test tool, but I don't recall the specifics. As I already wrote on Mastodon: I ended up just using the keyboard emulation. It might have been because I didn't get the API to work. Or maybe the emulation was easier and good enough. I'll try to look into it tomorrow, if I find some time. -
Difficulty with XKeys PIEHid32.dll in Delphi 10 Seattle
dummzeuch replied to Vitor Domingos's topic in General Help
Just a thought: Are you sure that the calling convention is stdcall? Maybe it is cdecl. -
You cannot override private methods.
-
Gutter width changes a few seconds after IDE startup in Delphi 12
dummzeuch posted a topic in Delphi IDE and APIs
I have got a curious effect with Delphi 12.2 (maybe it has already been there in Delphi 12.1 but I didn't notice it): When starting the IDE and opening a source code file in the editor, the gutter (the panel left of the source code containing line numbers and breakpoints etc.) has some given width. After a few seconds that width gets larger by approximately 16 pixels, moving everything to the right. This happens only the first time after starting the IDE. After that, closing and opening files keeps that new width. This is on a HD monitor with 1920x1200 pixel resolution and no scaling. Has anybody else noticed that effect? -
Delphi bug reports or feature requests to "vote"/comment for (important, fatal etc)/
dummzeuch replied to Tommi Prami's topic in Delphi IDE and APIs
At least one of my bug reports got resolved in Delphi 12 partially : IDE Menu does not display correctly when moving from one main menu item to another https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-516 This no longer happens the same way, but moving from Run to Components using the right arrow key now only highlights the Menu item without showing the menu. Pressing the down arrow key then shows the menu, so I guess I can live with that partial fix. Moving from Edit to Search with the right arrow key works as expected. Unfortunately the two most infuriating bugs since Delphi 11 have still not been fixed: IDE toolbars get scrambled over time https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-515 Switching Desktops does not work properly when using some mixed High DPI und HD monitor setups https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-514 -
I'm pretty sure installing different versions of CE on the same PC will work. But I have never used CE myself, so this is only an (educated) guess based on what I know about having multiple regular Delphi installations on the same PC. It would be a good idea to have an up to date image backup of your PC before trying it though.
-
They used to have a home grown QM system and replaced it for a reason.
-
Gutter width changes a few seconds after IDE startup in Delphi 12
dummzeuch replied to dummzeuch's topic in Delphi IDE and APIs
I have disabled all plugins to make sure it's not one of these causing it. -
New Warning in 12.2: Overloading a similar index type by declaring an array property 'Items'
dummzeuch replied to pyscripter's topic in RTL and Delphi Object Pascal
It was Delphi 6. (That's one of the reasons why GExperts dropped support for Delphi 5).