Mar 122017
 

For my dzComputerInfo tool I created a window without a title that can still be moved with the mouse. This is quite easy to do:

  1. To remove the title, set BorderStyle to bsNone.
  2. To let the user move it with the mouse, add the following message handler:
type
  TMyForm = class(TForm)
  private
    procedure WMNCHitTest(var Msg: TWMNcHitTest); message WM_NCHITTEST;
  end;

procedure TMyForm .WMNCHitTest(var Msg: TWMNcHitTest);
begin
  inherited;
  if (Msg.Result = htClient) then
    Msg.Result := htCaption;
end;

It tells Windows, that the user clicked on the title rather than the client area. Windows then does the rest, and the user can move the window with the mouse as if he clicked on the window title.

If you also want the window to have a context menu, you’ll have to change the message handler, so it does not affect right mouse clicks:

procedure TMyForm .WMNCHitTest(var Msg: TWMNcHitTest);
var
  Res: SmallInt;
begin
  inherited;
  Res := GetKeyState(VK_RBUTTON);
  if Res >= 0 then
    // only if the right mouse button was not pressed
    // (otherwise the popup menu wont show)
    if (Msg.Result = htClient) then
      Msg.Result := htCaption;
end;
Mar 122017
 

USB serial converters from FTDI are quite popular. We also use them at work quite a lot because they do not have the problem of the competing products (like Prolific): Windows does not detect devices on them as Microsoft ball point devices.

These converters can be configured interactively using a dialog accessible from the hardware manager’s device property dialog, page “Port Settings” by pressing the “Advanced …” button.

There are various settings, the most common ones to change are

  • COM Port Number
  • BM Options: Latency Timer
  • Miscellaneous Options: Serial Enumerator

The first one is obvious: It sets the COM port number of the emulated serial port. Every converter ever connected to the computer will reserve one COM port, so if you attach many of them you will sooner or later get rather high port numbers which many tools cannot use. The workaround is to force the driver to use a particular COM port here.

The second one, Latency Timer is not that obvious: It sets the latency timer in milliseconds to be used when the data received is not large enough to fill the buffer. Reducing this value from the default 16 to e.g. 4 solves many problems where data is being received with a delay of several seconds (e.g. the GPS position displayed is lagging behind your vehicle position by several seconds, which results in several 10th of metres at higher velocities. I have seen 4 seconds which at 60 km/h equals about 80 metres.)

The last one, Serial Enumerator, solves the Microsoft Ball Point detection mentioned above. As long as it is checked and a device is attached that sends data, Windows might mistakenly think it’s a mouse and the mouse cursor will jump all around the screen and even randomly click everywhere. This is quite annoying when it happens (and it happens very often when you connect a GPS). To resolve the problem, uncheck this option.
(Btw: Microsoft Ball Point devices have not been in use for over a decade, but the bug is still present in Windows XP, 7 and 8/8.1. (don’t know about Windows 10) despite users having problems because of it for many years. Shame on you, Microsoft!)

dzEditorLineEndsFix 1.0.3 released

 Delphi, Uncategorized, Windows, Windows 8.1  Comments Off on dzEditorLineEndsFix 1.0.3 released
Jan 212017
 

I have released a new version of my dzEditorLineEndsFix tool for Delphi 2006 to 2010. There is only one change: I removed the balloon hint it used to show at startup. It started to annoy the hell out of me (and I’m probably not the only one).

The tool also now has its own page on this blog.

Filter multiple criteria in Windows Explorer

 Uncategorized, Windows, Windows 7, Windows 8.1  Comments Off on Filter multiple criteria in Windows Explorer
Nov 092016
 

Note to self: It is possible to filter on multiple criteria – e.g. extensions – in Windows Explorer by combining them with OR:

.txt OR .doc
  • The OR must be written all upper case (AND is also possible).
  • *.txt will not work
  • It will search recursively
  • A semicolon (as in file filters) does not work.

More on filtering, grouping and searching here.

Force “unidentified networks” to be private or public in Windows 7

 Uncategorized, Windows, Windows 7  Comments Off on Force “unidentified networks” to be private or public in Windows 7
Oct 282016
 

Windows 7 has got an annoying feature that categorises network connections to be public, home or work networks. This might work for others but it has never worked for me. Even worse, for some reason the link that usually allows the user to change the network type sometimes is not available.

Microsoft even has got Knowledge base entry KB2578723 for that problem, which unfortunately didn’t work for me. I could change the current network, but after a reboot it again categorised the same network as unidentified network and public.

The solution is described in this article on sevenforums.com. Either use the Local Security Policy editor or RegEdit to change the setting how to treat unidentified networks. This setting is usually missing from the registry, so the keys must be created first. The easiest way to do that is the .reg file you can download from the page linked above. It looks like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24]
"Category"=dword:00000001

As I said: the registry keys don’t exist by default. Creating them manually is difficult because of the long number Microsoft chose to use, so it was either the Policy Editor or the .reg file for me. I took the Policy Editor approach but later verified that it created the registry entry shown above, so it’s probably safe to just use the .reg file.

Getting the system boot time in Windows

 Uncategorized, Windows  Comments Off on Getting the system boot time in Windows
Oct 132016
 

Today I needed to get the system boot time of my computer.

You can either open the system log and look for the entries a Windows start up writes there, or you can let a tool do the work:

@echo off
systeminfo | find "System Boot Time"
pause

In my case the result looks like this:

System Boot Time:          13.10.2016, 09:14:50
Press any key to continue . . .

There are a lot more options, detailed in this answer on StackOverflow.

Opening an explorer window from the folder select dialog

 Uncategorized, Windows  Comments Off on Opening an explorer window from the folder select dialog
Jul 122016
 

Ever used a program that showed one of the folder select dialogs and you wanted to open a normal explorer window showing that folder? There is no button for that and no entry in the popup menu, but you can add one:

Create a new shortcut in

C:\Users\≶yourname>\AppData\Roaming\Microsoft\Windows\SendTo

Enter “Explorer” as the location and name of the shortcut.

Done.

Now you have an “Explorer” entry the Send To submenu of all popup menus which in the case of a folder opens a new explorer instance for this folder.

SendToExplorer

Problem accessing a Windows XP share from a Windows 7 PC

 Uncategorized, Windows, Windows 7  Comments Off on Problem accessing a Windows XP share from a Windows 7 PC
Mar 092016
 

Today a problem drove me crazy: I tried to map a share on a PC running Windows XP from another computer running Windows 7. I kept getting the error that the username or password are invalid. On the other hand, accessing a share on the Windows 7 PC from the Windows XP PC worked fine. I could also use Remote Desktop on the Windows 7 PC to access the Windows XP PC so I know the credentials were fine.

It turned out that the cause for this was the system time of these two computers being off by more than an hour. Adjusting the time solved the problem for me.

WinHlp32 for Windows 8.1

 Uncategorized, Windows 8.1  Comments Off on WinHlp32 for Windows 8.1
Dec 202015
 

Microsoft dropped support for the old WinHelp (*.hlp) file format in Windows 7 (or was it in Vista?). They provided a download that added the missing WinHlp32.exe (and probably quite a few other files) back so we could display .hlp files again. Today I had the need to do that on Windows 8.1. Unfortunately I run into several issues:

  • There are multiple downloads and it isn’t trivial to find the right one (Update for Windows 8.1 for x64-based Systems (KB917607) worked for me)
  • The download is a .msu file which doesn’t install if your windows does not have one of the supported language packs. If you get the error “The update does not apply to your system”, install the English-US language pack (I didn’t have that, I used English-GB.)
  • The installer package takes forever to prepare, then asks you whether you want to install KB917607. After a while it looks as if it is finished. I tried to open a .hlp file and it still didn’t work. Looking closer revealed yet another window open requiring me to acknowledge the license terms. So I did that and lo and behold: I could finally view .hlp files again.

Why does Microsoft make everything so complicated?

%d bloggers like this: