Archive for the ‘Delphi 5’ Category
Posted by jpluimers on 2021/09/23
From a long time ago, but got a request for it a while ago is [WayBack/Archive.is] Howto create C-Header for Delphi/Free Pascal/Lazarus DLL – data types – Stack Overflow:
I have used the below construct to generate header files compatible with the C-mode compiler of Visual C++ 6 from Delphi 5 code when Delphi had the -JPH switch (see notes below).
Note that I have not used this since Delphi 5, but the switch has since then been expanded:
Somewhere along the line, the [
WayBack]
JPHNE switch has been added to the
dcc32 command-line compiler:
-JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
It generates the .hpp files to import the DLL that was written in Delphi.
Notes from the Delphi 5 era:
{ Visual C++ 6 does not like nested structs/unions the way that BC++ can handle them.
Visual C++ 6 requires the "typedef" to be present AND the typename AFTER the struct definition.
You will see this when defining TConversationId, TReturnKey and other types that depend on nested structs/unions
The trick is to perform these steps each and every time this unit changes:
- Generate this unit once with all the EXTERNALSYM disabled.
- Then the DCC32 -JPH will generate the basic structs for them.
- Copy all the nested struct and union definitions to this file
- Embed the definitions with (*$HPPEMIT '' *)
- Append the typename at the end of the struct definition
- Enable all the EXTERNALSYM again
- Regenerate the HPP files by using DCC32 -JPH
To make this process easier, we have introduced two new conditional defines:
- BCB - disable EXTERNALSYM, disable HPPEMIT
- VC6 - enable EXTERNALSYM, enable HPPEMIT
A similar thing is with these constructions that VC6 does not like those either:
- short strings (BCB defines them as "SmallString<##>" which VC6 does not like).
- short integers (BCB defines them as "Shortint" so we have included an HPPEMIT for that)
}
{$ifdef win32}
{ important! Makes sure that the all enumerated types fit in exactly one byte each! }
{$Z1}
{ force the C/C++ HPP header files to have the C/C++ compiler pack structure elements on byte boundaries }
{$ifdef BCB}
{$HPPEMIT '#pragma option push -a1' }
{$endif BCB}
{$endif win32}
And the download (hopefully I have converted it to git by then):
–
–jeroen
Posted in Delphi, Delphi 5, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/07/01
I thought I had scheduled a blog post about the great tool on [WayBack] SequoiaView Homepage, but didn’t. In the mean time, Paolo Buffa posted an overview with a really nice historic perspective:
Is amazing from how many years I’m using this program, and how many operating systems it managed to go thru almost unscathed, without modification.
Paolo Buffa
Source: [Archive.is] SequoiaView: a piece of history. – Data Center IT – Spiceworks
I still use it, despite it being quite old: 2002 era, written in Delphi 5. It’s beautiful in part because of its anciency, but also because it is so simple and intuitive that I still use it regularly.
The age also shows in the web page (which when writing it was still on-line): The SequiaView home page link above is actually a classic frame inside [WayBack] The SequoiaView Homepage. Back then, it was already starting to be considered obsolete to write HTML using frameset [WayBack] Framing (World Wide Web) – Wikipedia.
The SequoiaView [WayBack] Download Page even points to non-existing ftp-download URLs via counter CGI scripts:
None of them have been archived by the WayBack machine: https://web.archive.org/web//ftp://ftp.win.tue.nl/pub/home/sequoia//
To verify alternative downloads, just check these hashes:
| hash command |
filename |
hash output |
$ md5 |
Sequoia1.3Install.zip |
MD5 (Sequoia1.3Install.zip) = 28d356f2bafe258805794257c284a075 |
$ md5 |
Sequoia1_3XPInstall.exe |
MD5 (Sequoia1_3XPInstall.exe) = 142586a5cc7a0139bde8c13e5cc4d301 |
$ shasum |
Sequoia1.3Install.zip |
762ab30177a7f6a0d4f173fd2442ba7b61df4c2e Sequoia1.3Install.zip |
$ shasum |
Sequoia1_3XPInstall.exe |
c1db10a0f7d36adbc14b5a7a3f08fc35db1bee8b Sequoia1_3XPInstall.exe |
I’ve a copy in my archive that I just use in a portable way: just copy over SequoiaView directory with these files in it:
Archives.col
DEFAULT.COL
Images.col
License.txt
Movies.col
ReleaseNotes.txt
Sequoia.cnt
Sequoia.exe
SEQUOIA.HLP
Sound.col
You can download this from gist.github.com/jpluimers/b0df9c2dba49010454ca6df406bc5f3d (ef94f1875377f4054e3a434f8942e1749f0af74a.zip).
A few things that could be fixed (if ever hopefully MagnaView open sources it: [WayBack] @jpluimers More @magnaview did you ever consider to open source the Delphi code for http://www.win.tue.nl/sequoiaview/ or give someone NDA access to fix some bugs?):
- Access violation when re-scanning a drive
- Option to show multiple links to the same physical file
- Indication of more rights needed to index a file or directory
- Better explorer integration (via context menu)
Read the rest of this entry »
Posted in Delphi, Delphi 5, Development, Power User, Software Development, Windows | Leave a Comment »
Posted by jpluimers on 2018/07/11

When accessing the VCL from multiple threads at the same time: adopted from …\DEMOS\THREADS\THRDDEMO.DPR
Great question a while ago:
[WayBack] “Don’t access VCL from a background thread” – how to demo that? – Primož Gabrijelčič – Google+
For me, the ultimate way why not to access the VCL from a background thread is the precursor of the official threads demo that ships from Delphi 2 to Delphi XE6 in ...DEMOS\THREADS\THRDDEMO.DPR. where you’d think the thread isolation would be in ...DEMOS\THREADS\ThSort.pas but actually is in ...DEMOS\THREADS\SortThds.pas.
The first public showing of that demo did not include main thread protection. It originates from a session at the the 1995 Borland Developers Conference where Ray Konopka showed the below code from Bob Ainsbury.
That session reminded why this joke [WayBack] Via the EKON20 sessions… – Jeroen Wiert Pluimers – Google+ was so funny: “When Ray Konopka enters the room you have a Raize condition.“.
The question above also made me find back this reference to BorCon95 in San Diego:
Read the rest of this entry »
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 10.2 Tokyo (Godzilla), Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »
Posted by jpluimers on 2018/01/10
As a by-effect, this article seems to one of the few that shows where Delphi uses the .dres file extension introduced around Delphi XE.
Recently I had to play some notification sounds in a Windows Delphi application where the application deployment should be as easy as possible: preferable copying the EXE around.
Playing a sound file seems easy, especially if it is a [WayBack] WAV file: just use the [WayBack] PlaySound or the (older) [WayBack] sndPlaySound API functions.
But if you start searching on the internet, you see lots of curious implementations for playing WAV resources through sndPlaySound.
The actual implementation is really really easy though, just make sure you follow the steps right and nothing can go wrong.
[WayBack] The full source code is on my BeSharp.net repository, here is how to to it step by step:
The steps depend on the MMSystem unit, so most of the code translates back to [WayBack] Turbo Pascal for Windows (yes, the 16-bit Pascal days when the MMSystem unit was introduced) with the exception of the SND_SENTRY flag.
The thing that more recent Delphi versions made a lot easier is embedding WAV files as WAVE resources, more on that further on. Read the rest of this entry »
Posted in Borland Pascal, Delphi, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Pascal, Software Development, Turbo Pascal | Leave a Comment »
Posted by jpluimers on 2017/07/04
Just in case I need any of them: now in chronological order.
MarcoDelphiBooks – http://www.marcocantu.com
Source: MarcoDelphiBooks
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/02/07
A long time ago, Thomas Mueller (dummzeuch) – Google+ reminded [WayBack] me of this which I required a short while ago:
You can use AcquireExceptionObject():
AcquireExceptionObject returns a pointer to the current exception object and prevents the exception object from being deallocated when the current exception handler exits.
Then you can send the pointer to another thread and if you raise it there it will be freed for you, otherwise you must call ReleaseExceptionObject() to free it.
After the answer by Remy Lebeau [WayBack] and Remko [WayBack] is a comment [WayBack] by [WayBack] that mentions AsyncCalls.pas that now is available on GitHub [WayBack].
If you have a very old (version <= 5) Delphi or just want to look at how AcquireExceptionObject [WayBack] looks like just look at a similar implementation there [WayBack]. Note that instead of the ReleaseExceptionObject [WayBack] call, AsyncCalls re-raises the exception [WayBack].
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/12/21
Some of the [Wayback] Ken Thompson – Wikiquote entries come from a great [Wayback] 1983 ACM Turing Award Acceptance Lecture [Wayback] “Reflections on Trusting Trust”.
That lecture used to be on http://cm.bell-labs.com/who/ken/trust.html
But it isn’t, and was not in the WayBack machine and neither in the Google Cache [Archive.is] because of the [Wayback/Archive.is] robots.txt. Historic link rot galore!
Edit 20210728: by now it is in the Wayback machine again; the earliest archived copy is from 2001, it also shows that as of april 2015 it is gone from the bell labs server.
The lecture is about [Wayback] compiler viruses and viruses actually did this at least a few times: Wayback: Delphi in 2009 and to [Wayback] XCode in 2015.
A few nice links from [Wayback] ACM Classic: Reflections on Trusting Trust – Google Groups though:
And archived versions of (I hope accurate) copies of the article:
Finally I found a PDF copy of the original ACM prints that Greg Ganger of Electrical and Computer Engineering at Carnegie Mellon University has online. It’s archived too.
–jeroen
Further reading:
Posted in *nix, Conference Topics, Conferences, Delphi, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Development, Event, Fun, Internet, link rot, Power User, Quotes, Software Development, T-Shirt quotes, WWW - the World Wide Web of information, xCode/Mac/iPad/iPhone/iOS/cocoa | Leave a Comment »
Posted by jpluimers on 2016/11/29
A long time ago, Lars Fosdal wrote this on the Delphi G+ group:
It really is beyond me why there is no Project.rc file which includes
- Project.version.rc
- Project.icon.rc
- Project.themes.rc
- Project.manifest.xml
- and so forth.
That way, the .res file would be a compile-time thing (or even a thing of the past) – and the resource linker would assemble the various bits from their individual sources.
It has been an issue forever. Vincent Parrett correctly commented that if you clean out too much out of the Project.res file, the IDE gets confused:
The only thing it is used for is version info and the mainicon (the IDE gets confused if don’t do that).
In my own experience, this isn’t the case for all Delphi versions, but I forgot which versions suffer and which don’t. I think the IDE theming issue omitting the Application word in the .dpr is related.
Like many of the G+ commenters, I’ve switched to script based resources for my own projects a long time ago. That’s also the reason why I forgot: this approach just works for any Delphi version.
This post is a reminder to self to see if the IDE has finally refrained from doing Project.res handling itself.
–jeroen
Source: The curse of the Project.res file…
Some related posts:
Posted in Delphi, Delphi 1, Delphi 10 Seattle, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/08/25
Delphi Component/Tool vendors have to support a truckload of Delphi and C++ Builder versions which can be a pain: they have to work around problems in Delphi and C++ Builder versions that have long been abandoned by Borland/CodeGear/Embarcadero/Idera/…
This means that sometimes the Delphi Component/Tool vendors have to work around stuff in a way normal applications vendors would never do.
Recently I learned that sometimes this can be a painful thing: keeping DFM files in binary state.
I’m not kidding about either the DFM file format nor about supporting old versions:
- Delphi has supported text based DFM files since like Delphi 2 for most of the features (yes, ‘most’ is the crucial word here) and by default stored DFM files in text format since Delphi 5.
- For the Component/Tool Vendors, even Delphi 7 makes money though usually less than Delphi 2007 or the C++ Builder side of things.
The ‘most’ applies to this nice ARM compiler bug in Delphi 19.0.13856.4978 (for mere mortals, that’s Update 1 for RAD Studio XE5, Delphi XE5 and C++Builder XE5; I wish vendors would list those numbers/products in a central place):
- [Android] MsBuild (dccAarm) error when compile FireMonkeyMobile projects with fmx forms
- Project: Delphi
- Build #: 19.0.13856.4978
Source: [WayBack] QualityCentral
That’s why TeeChart still has most DFM files stored as binary files (again the ‘most’ word).
For version control and searching this is a pain, so normal application developers (the ones not using Delphi XE5 Update 1 for Android work) should run convert.exe with the -t (target=text) switch on DFM binary files.
Oh: this is fixed in version 19.0.13856.4978 (yes, that’s XE5 Update 2).
–jeroen
Via:
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Kylix, QC, Software Development | Leave a Comment »