Showing posts with label COM DLL. Show all posts
Showing posts with label COM DLL. Show all posts

Monday, July 28, 2008

[Delphi] Updating SysTray

I'd been lurking at ITtoolbox for a while and saw this request for help with updating the system tray.

I've had similar problems myself. For instance, if you use boost or some similar process-control tool to kill the Skype.exe and SkypePM.exe programs, the processes disappear from memory but the system tray still shows the Skype icon until you move the mouse over the icon. Then the tray refreshes, the Skype icon disappears and the remaining icons rearrange.

On
Experts Exchange I found a bit of Delphi code which moves the mouse over the systray (using system messages rather than moving the mouse pointer itself.) This convinces Windows to update the systray. Because not everyone has an Experts Exchange membership, I've turned the code into a COM DLL, which you can download. Source is included (Artistic2 license.) A copy of the original Experts Exchange code can be found here.

Once you've registered the DLL (regsvr32 UpdateSysTray.DLL) you can use it in anything that supports ActiveX/COM objects. For example, in VBScript:


© Copyright Bruce M. Axtens, 2008

Saturday, November 11, 2006

[Delphi] COM of libiconv

I have just finished my first serious bit of Delphi programming, using Turbo Delphi Explorer. As a RAD/IDE it's pretty good. However, given the limitations of the Explorer version, I'll upgrade to the Pro version fairly soon.

COMlibiconv is an in-process COM object and was born out of the company's need to convert some multibyte encodings into Unicode. It's based on DIConverters, a unit made available by Ralf Junker of
The Delphi Inspiration. DIConverters is licensed as LGPL. COMlibiconv will also be LGPL.

(Did I mention that I'm working again? No? Okay, well now I work as a software engineer for Strapper Technologies, of Fremantle, WA, Australia, makers of the Protium language.)

I'll be posting version 1.0 of the project up on Freshmeat by the end of next week, God willing.

COMlibiconv appears to work. I've used it in VBScript, late-bound, as
and I think my boss has used it, early-bound, in VB6.

At this stage the methods and properties exposed are as follows (taken from the source):
The function iconv_toUnicode takes a string defining the name of the multibyte encoding, the string to be converted, and two integers stating where to start and when to finish. I should probably give those default values so that the method can be called with just the encoding and the string.

ErrorCode contains an integer value which, when Success is false, represents what went wrong. An enumeration of possible error values is indicated and may make it into the next version.

Aliases gives all the various names for an encoding, indexed by a number from zero to the number of encodings (which can be found using Count).

CNames is also indexed in a similar way, and returns what I have called the 'CName' of the encoding. It's stuff that was in the DIConverters unit. I haven't found a use for it, but included it anyway.

The next version will, God willing, contain a method to allow conversions from Unicode back to multibyte.

If you're interested in this, and it hasn't appeared on Freshmeat by 18th November 2006, write a comment to remind me.

© Copyright Bruce M. Axtens, 2006