Monday 31 August 2020

Delphi bug: Invalid Window Handle Error 1400

My program developed a bug where sometimes on exit an access violation error and invalid window handle error would appear.

invalidhandle

The bug wasn’t totally random but occurred when some sectors in a grid were selected but not when other sectors in the same grid were selected. The grid was an image.

The program uses several TMemo components to display information pertaining to the sector selected and the number of lines displayed in each TMemo varies for each sector.

By trial and error it was found that the bug was caused by appending strings to a TMemo which happened to be the seventh and last TMemo on the form.

I am not skilled enough to get to the bottom of the cause but it seems the bug was caused by the number of lines appended to the TMemo and the length of the lines. No exceptions were raised here though.

Fewer lines no problem. More lines no problem. Shorter lines no problem.

I don’t know why but a TMemo.Lines.Text length between 284 and 308 caused the error.

I fixed the error by ensuring the text length was not between these two values.

Using Delphi Community Edition 10.2.3 on Windows 10.

Friday 28 August 2020

Restore window border GOG Tomb Raider 4 & 5

The GOG versions of Tomb Raider 4 and Tomb Raider 5 include a fix to remove the window border when playing fullscreen on modern Windows versions.

This fix however also removes the window border when playing in windowed mode and leaves the user unable to move the window.

This post details how to undo the fix and restore the window border.

TR5noborder


Tuesday 21 July 2020

Building Wadmerger with Visual Basic 6

The Wadmerger source code was released recently [link]. Wadmerger is a program used in Tomb Raider Level Editor (TRLE) building.

Wadmerger was written in Visual basic 6 which is an old language and this post shows how to get it working on Windows 10 using a Windows XP virtual machine.

Tuesday 9 June 2020

Corrupt Open Live Writer draft fix

I use Open Live Writer to create posts for this blog.

Recently one of my draft posts became corrupted.

In a draft of about 100 lines and many pictures only the first few lines were selectable in the Edit view.

When I switched to Source view all the unselectable text and pictures disappeared destroying my post.

The problem was a stray </div> tag in the post that somehow appeared after inserted a split post.

Since most of the text disappeared when I switched to Source view I had trouble deleting the problematic </div>.

The solution was to close Open Live Writer and restart. But before loading my corrupt draft file, switch to Source view.

This way all the html source appeared and I was able to delete the unmatched </div> tag.

Sunday 31 May 2020

Building Tomb Raider III in Visual Studio 2019

This post will outline the steps involved in building the leaked Tomb Raider 3 code in Visual Studio 2019 Community Edition.


Friday 8 May 2020