-
Content Count
2771 -
Joined
-
Last visited
-
Days Won
147
Everything posted by Anders Melander
-
Nested TParallel.For: Immediate deadlock
Anders Melander replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
Reproduced. Delphi 11.2, 32- and 64-bit 4-core CPU. -
-
Everything you need is available through the COM+ Tracking API. If you just need the statistics you will probably need to use the IGetAppTrackerData interface.
-
Unsupported 16-bit resource in *.RC file
Anders Melander replied to lookin030577's topic in General Help
I can confirm that there are no errors in the res file. This is because Delphi will generate the "default" res file thus overwriting your custom one. The default res file is the one referenced by the directive "{$R *.res}". I suggest you name your res file so it doesn't conflict with the default project res file. I also suggest you either remove the MAINICON icon from your res file or delete the "{$R *.res}" directive. Otherwise, you will get a duplicate resource warning (because the project res file also contains a MAINICON icon) and the linker will have to discard one of them. With regard to "RLINK32: Unsupported 16bit resource in file" it could be many different things that cause this and without knowing exactly what your rc file looks like it's impossible to guess which one it is. You could try making sure that the rc file is in UTF-8 format. -
Unsupported 16-bit resource in *.RC file
Anders Melander replied to lookin030577's topic in General Help
Post your RES file. The fact that PEResourceExplorer can read it is no guarantee that it is correct. You might also try using the SDK resource compiler instead of brcc32 (which has known limitations). You can select the RC compiler to use in the project options. -
One compiles a 32-bit application, the other a 64-bit.
-
ChatGPT, is that you? Okay, now I've had too much coffee.
-
WOW, indeed 🙂 Your subconsciousness at work.
-
https://learn.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector
-
Ah!... Have a look at C:\Windows\SysWOW64\fr-FR instead See it now?
-
Sorry, I should have been more clear in my sarcasm. I probably haven't had enough coffee yet. What I meant to "say" was that external tools are irrelevant in this context. The OP asked for a Delphi solution for use with FMX.
-
Reproduced. Not only does the file open dialog not show all files. It refuses to accept the names of the files it doesn't show. I have reproduced with both Delphi applications ** and notepad++ (which presumably isn't written in Delphi). Notepad.exe can see the files. Intriguing... **) Resource Editor 🙂
-
Does it work well with FMX? I like cats.
-
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Sure; It's a nice party trick. But it gets old. Exactly. Most of the examples I have seen so far of ChatGPT magically writing code usually involves the operator coaching it through iterations of incorrect answers toward the known correct answer. ChatGPT's linguistic abilities are very impressive. The rest, not so much. -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
Um... An explanation of why it's interesting for example. As far as I can tell it performed just as one could expect. Is that interesting? -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I think you're assuming that I find the answers interesting, which I do not. I'm asking why he thinks they're "quite interesting". From a socio-psychological viewpoint, I think people's view of ChatGPT is "quite interesting". Beyond that, from what I've seen so far, the only practical use for ChatGPT is to waste everybody's time. YMMV -
Some more fun with ChatGPT and Delphi
Anders Melander replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
How so? -
I wouldn't be surprised. After all, there was a time when Basic programs ran faster if you used short variable names 🙂
-
Have you tried resetting the component list?
-
WHAT? I DON'T UNDERSTAND YOU. SPEAK LOUDER! I'M A BIT DUMB SO YOU'LL HAVE TO SPEAK REALLY, REALLY SLOW - AND LOUD.
-
You can see from the method signature that Key can be modified (it's passed by reference; as a "var") and that Shift cannot (it's passed by value). We cannot tell if it's "the best way" since you haven't really explained what problem you're solving (see XY problem) - And we cannot predict your future. One thing to be aware of is that keyboard events are read from the message queue in the order in which they occurred. Keybd_Event will append to this queue so you might end up with a key sequence that doesn't correspond to what actually occurred.
-
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.RegisterComponents https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_RegisterComponents_Procedure
-
Actually, IME, the PNG sub-format is the least troublesome; It just has a PNG file instead of the regular BMP pixel data. No, it's the non-alpha formats, and in particular, the 1 bpp format, that is the worst. If the task here is to convert a PNG to an ICO I would just create an ICO header with a single 32bpp PNG sub-image and then simply use the PNG as-is for the sub-image. Something like this (not tested): const RES_ICON = 1; RES_CURSOR = 2; type TIconDirectoryHeader = packed record Reserved: Word; // Reserved; must be zero. ResType: Word; // Specifies the resource type. This member must // have one of the following values: // RES_ICON Icon resource type. // RES_CURSOR Cursor resource type. ResCount: Word; // Specifies the number of icon or cursor // components in the resource group. end; TIconDirectoryEntry = packed record Width: Byte; Height: Byte; ColorCount: Byte; Reserved: Byte; ResInfo: packed record case byte of RES_ICON: ( IconPlanes: Word; IconBitCount: Word); RES_CURSOR: ( CursorHotspotX: Word; CursorHotspotY: Word); end; BytesInRes: DWORD; ImageOffset: DWORD; end; TColorDepth = 1..32; // Bits per pixel. Not bits per plane. function ColorDepthToColors(ColorDepth: TColorDepth): cardinal; begin Result := 1; while (ColorDepth > 0) do begin Result := Result shl 1; dec(ColorDepth); end; end; // PngStream: A stream containing the PNG // IcoStream: The outout stream // AWidth: Width of the PNG // AHeight: Height of the PNG // AColorDepth: Color depth of the PNG procedure SavePngStreamToIcoStream(PngStream, IcoStream: TStream; AWidth, AHeight: integer; AColorDepth: TColorDepth = 32); begin var IconDirectoryHeader: TIconDirectoryHeader := Default(TIconDirectoryHeader); var IconDirectoryEntry: TIconDirectoryEntry := Default(TIconDirectoryEntry); IconDirectoryHeader.ResType := RES_ICON; IconDirectoryHeader.ResCount := 1; IcoStream.Write(IconDirectoryHeader, SizeOf(IconDirectoryHeader)); // Note : 256x256 icon sets Width&Height to 0 (according to docs) or to 255 (according to .NET) IconDirectoryEntry.Width := AWidth and $FF; IconDirectoryEntry.Height := AHeight and $FF; var BitCount := 0; var ColorCount := 0; case AColorDepth of 1, 4: ColorCount := ColorDepthToColors(AColorDepth); else BitCount := AColorDepth; end; IconDirectoryEntry.BytesInRes := PngStream.Size; IconDirectoryEntry.ImageOffset := SizeOf(IconDirectoryHeader) + SizeOf(IconDirectoryEntry); IconDirectoryEntry.ResInfo.IconPlanes := 1; IconDirectoryEntry.ResInfo.IconBitCount := BitCount; IconDirectoryEntry.ColorCount := ColorCount; IcoStream.Write(IconDirectoryEntry, SizeOf(IconDirectoryEntry)); IcoStream.CopyFrom(PngStream, 0); end;
-
I'm guessing you've never had to write code that can read and write icons in all of the supported formats 🙂
-
ANN: Better Translation Manager released
Anders Melander replied to Anders Melander's topic in Delphi Third-Party
No. I'm guessing you want it to update the project with any changes made to the EXE, right? But why? What problem are you trying to solve?