Creating animated GIFs from screenshots

 Windows  Comments Off on Creating animated GIFs from screenshots
Nov 282015
 

I have posted two animated GIFs lately to show features of GExperts or the popup menu entry for Windows Defender.

These GIFs were created using ScreenToGif which is an open source tool written by Nike S. Manarin. One feature of it that I particularly like is that it is a "Portable App", that is, it works without needing an installer.

Now, I’m wondering if I could demonstrate its capabilities by recording a screen video of recording a screen video.

And would you believe it? It’s possible!

ScreenToGif-of-ScreenToGif

(Click on the picture to open it full size and animated.)

 Posted by on 2015-11-28 at 17:07

Add a “Scan with Windows Defender” context menu to any folder or file

 Windows, Windows 8.1  Comments Off on Add a “Scan with Windows Defender” context menu to any folder or file
Nov 282015
 

Windows Defender is the virus scan tool that is included with Windows 8 and later. While it provides basic security it does not have any of the convenience functions that other virus scanners have. In particular I miss a context menu option to scan a file or folder.

ScanWithWindowsDefenderMenu

So I turned to Google and found How to add the Windows defender into Windows Explorer’s right click menu on SuperUser and How to Add Any Application Shortcut to Windows Explorer’s Context Menu on How-To Geek. Both go through great length with pictures and text to describe how to do it, but basically a simple .reg file would have been sufficient.

To add a "Scan file with Windows Defender" entry for all files, you need this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\WindowsDefender]
"Icon"="%ProgramFiles%\\\\Windows Defender\\\\EppManifest.dll"
"MUIVerb"="Scan with Windows Defender"

[HKEY_CLASSES_ROOT\*\shell\WindowsDefender\Command]
@="\"c:\\Program Files\\Windows Defender\\MpCmdRun.exe\"  -scan -scantype 3 -SignatureUpdate -file %1"

(download link)

And for a "Scan folder with Windows Defender" entry for each folder, you need this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\WindowsDefender]
"Icon"="%ProgramFiles%\\\\Windows Defender\\\\EppManifest.dll"
"MUIVerb"="Scan folder with Windows Defender"

[HKEY_CLASSES_ROOT\Folder\shell\WindowsDefender\Command]
@="\"c:\\Program Files\\Windows Defender\\MpCmdRun.exe\"  -scan -scantype 3 -SignatureUpdate -file %1"

(download link)

Both open a console window for the console version of Windows Defender to run. That’s a bit ugly but we aren’t in this for a design award, are we?

To add these files to the registry just double click them. Windows will warn you about possible threads. It’s a good idea to read through files like these before double clicking. Maybe I am just trying to hack your computer? 😉

It works for me on Windows 8.1, but it should also work on other Windows versions like 10.

 Posted by on 2015-11-28 at 16:34

Adding an entry to the Delphi IDE’s about dialog

 Delphi  Comments Off on Adding an entry to the Delphi IDE’s about dialog
Nov 222015
 

Starting with Delphi 2005 the IDE provides an API for plugins to add an entry to its about dialog. It’s pretty simple to use and many plugins and components use it nowadays. But there is one thing that in my opinion most of them get wrong. My first attempt looked like this:

if Supports(BorlandIDEServices, IOTAAboutBoxServices, AboutBoxServices) then begin
  bmSplashScreen := LoadBitmap(HInstance, 'SplashScreenBitMap');
  Result := AboutBoxServices.AddPluginInfo(
    'GExperts',
    'GExperts is a [...]',
    bmSplashScreen,
    False,
    GetVersionStr,
    'open source');
end;

and resulted in this:

Gexperts-About

The string "Product Licence Status:" annoyed me because it just didn’t make any sense. But since this is pretty much what most other plugin entries look like, I thought it just must be the way for it to look. But then I found this entry added by the Delphi Praxis Help-Booster:

HelpBooster-About

No Prefix? WTF? How did he do it? I asked for input on Google+ but got no help, apart from Uwe Schuster’s rather cryptical answer

Read again and again the parameter list of AddPluginInfo and once you understood it, it will appear as expected.ï»ż

which I just didn’t understand (even though he was right but …).

The solution hit me quite a few minutes later: Just supply an empty string to the LicenceStatus parameter and put the version information into the SKUName parameter.

if Supports(BorlandIDEServices, IOTAAboutBoxServices, AboutBoxServices) then begin
  bmSplashScreen := LoadBitmap(HInstance, 'SplashScreenBitMap');
  Result := AboutBoxServices.AddPluginInfo(
    'GExperts',
    'GExperts is a [...]',
    bmSplashScreen,
    False,
    '', // leave this empty!
    GetVersionStr);
end;

And it works:
Gexperts-About-2

I should really be used to feeling stupid by now.

 Posted by on 2015-11-22 at 20:34

Experimental GExperts Version 1.38 2015-10-21 released

 Delphi, GExperts  Comments Off on Experimental GExperts Version 1.38 2015-10-21 released
Nov 212015
 

Again, there is nothing new about the formatter code. But there is a new option to improve the IDE search path dialogs:

Improved search path config dialog

What it does is replace the list box in the search path dialog with a memo, so editing that path is much easier (in my opinion) than before. Unfortunately I have yet to figure out how to sensibly implement the "Replace", "Delete" and "Delete Invalid" button functionality, so they are disabled for the time being.

Click on the picture for an animated GIF that shows you the change.

In addition, since I was at it, I added short cut keys to the Up/Down buttons: Ctrl+Up / Ctrl+Down. These work even if you don’t replace the listbox (And let me tell you: It wasn’t easy to get this to work but that’s a topic for a different blog post).

There is another change in my experimental GExperts versions, that some of you might not like: There is only one version, the "Regular Expert". I dropped the "Editor Expert" version because it became too tedious to maintain those two versions in parallel. Also, since in the (hopefully near) future the code formatter will be part of the official GExperts, I had to decide which version to keep. If you don’t like this, you are welcome to grab the sources modify them and and compile your own version.

Head over to the Experimental GExperts page to download it.

dzMdbViewer 1.0.1 released

 Delphi  Comments Off on dzMdbViewer 1.0.1 released
Nov 202015
 

dzMdbViewer is a small tool I wrote, when I was stuck without a MS Access installation but needed to have a look into a .MDB file (and later .ACCDB file, if the Access Database Engine 2012 is installed).

It can open these files and display a list of queries and tables stored in them as well as the data they contain.

Table Data

Also, for tables, it can show the field definitions.

Table Definition

Today I fixed a few bugs and released version 1.0.1. You can get it from OSDN. The source code is available too.

 Posted by on 2015-11-20 at 18:37

Classname with !dx suffix?

 Delphi  Comments Off on Classname with !dx suffix?
Nov 192015
 

Today I had an interesting bug to fix:

I used a form’s Classname (Yes, I have a reason not to use the Name.) to persist its size in the registry and wondered why it didn’t work. Looking at the registry entries I found, that there was an entry with the class name suffixed by a ‘!dx’.

So I placed an appropriate breakpoint in the constructor and destructor respectively of the form and found that everything was fine in the constructor but in the destructor there was this suffix.

On further investigation it turned out that the culprit was dxgettext. In one of the contributions that were submitted by users but which in this case I committed myself, the class name was suffixed with !dx as a debug help. It’s not necessary for the functionality.

The fix of course was to disable this code. There is now a new conditional define dx_ChangeProxyClassName in the current gnugettext.pas code, that controls whether the suffix is added or not. The default is to not add it.

 Posted by on 2015-11-19 at 16:03

Bulk-moving units in Delphi

 Delphi  Comments Off on Bulk-moving units in Delphi
Nov 082015
 

If you change the structure of a Delphi project, you will often face the challenge of moving many units from one directory to another, e.g. you change the name of a subdirectory from src to source:

myproject
  \myproject.dpr
  \myproject.dproj
  \src  <=== change to "source"
    \MyUnit1.pas
    \MyForm1.pas
    \MyForm1.dfm

In ancient Delphi versions, you would just open the .dpr file in a text editor, use search and replace to change the path and the Delphi IDE would happily work with that new .dpr file.

Starting from Delphi 2007 the IDE stores the path to the units included in the project in two files: The .dpr file and the .dproj file. If they don't match, you can get all sorts of weird errors even though it seems to work at first.

That leaves you the following options:

  • You could open your project in the Delphi IDE remove all units from it and add them again at the new location. No problem if there are only a hand full of units, but with a typical large project this could easily take half an hour and is rather boring (and therefore error prone).
  • You could change the paths not just in the .dpr file but also in the .dproj file using search and replace. But beware, the text you replace might be used in some other places too which you might not want to change. XML files are not really meant to be modified by humans.
  • You could change the paths in the .dpr file and simply delete all
    <DCCReference Include="path goes here">
      <Form>form name goes here</Form>
    </DCCReference>

    entries from the .dproj file. This is much easier done than a search and replace. Afterwards you open it in the IDE, make a small change to the .dpr file (e.g. add and delete a white space) and save it. The IDE will happily recreate all these entries for you.

 Posted by on 2015-11-08 at 19:43

dzTimer 1.1.0 released

 Delphi  Comments Off on dzTimer 1.1.0 released
Nov 012015
 

dzTimer is not really something to write home about. It’s a simple countdown timer I wrote to familiarize myself with Lazarus for Windows. It has the following features:

  • Configure and store a list of commonly used timers
  • Display the remaining time as the caption when minimized
  • Minimize to icon tray (new)

dzTimer

Of course it is easy to use, but that’s not a feature but a basic requirement in my book.

The project is on SourceForge.

 Posted by on 2015-11-01 at 18:05