-
Content Count
3021 -
Joined
-
Last visited
-
Days Won
108
Everything posted by dummzeuch
-
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
I got it from some random 😉 post on StackOverflow (I could not find it on any Microsoft site) -
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). -
Weird error on latest SVN source release build with D12 (fix versio)
dummzeuch replied to Tommi Prami's topic in GExperts
Apparently that problem still exists in Delphi 12.2 😞 -
Pointer casting with NativeUint
dummzeuch replied to duzzell's topic in Algorithms, Data Structures and Class Design
In which way were they buggy? I'm only aware of the wrong declaration of NativeInt as Int64 in Delphi 7 to 2007. These compilers were all 32 bit only, so NativeInt should have been Integer. That was fixed in Delphi 2009. -
Your event handler must match the signature of the event to which you want to assign it. Many events are of the type TNotifyEvent, so this is the most versatile event signature. But I'm not sure I understand what exactly you want to achieve. Maybe a universal message handler would be a better fit for your purpose? But such a handler can not just be assigned.
-
Pointer casting with NativeUint
dummzeuch replied to duzzell's topic in Algorithms, Data Structures and Class Design
That code was probably written for a Delphi version that did either not have a NativeInt type (Delphi 5 or earlier) or possibly declared it incorrectly. The latter was the case for Delphi 6 to 2007. -
Yes, it works as intended with most windows by now. And turning it off is not an option anyway.
-
The problem is not that the settings are not saved. I checked it and they are. The problem is that the settings are loaded after the scaling has been initialized and that initialization saves the font sizes. Then the settings are loaded and the font sizes are set, just to be overwritten again when scaling is applied after that. This is why the problem only occurs in Delphi 11 and 12, but not e.g. in Delphi 10.2, as I stated above.
-
HighDPI scaling
-
The remedy is not to use scaling. 😉 (won't help here either, because the code is still called.) Not yet, unfortunately it's rather complex to fix this, especially since this applies to all dialogs that allow changing the font size.