A programmer’s day

November 12th, 2002 Comments Off on A programmer’s day

I had lots of fun at work today. After a long time developing pure web applications, I had to implement an ActiveX because some projects in the company required a specific tool that couldn’t be done using pure HTML and related technologies — al least, not in a straight-forward way. So, I returned temporarily to Delphi, after a long time using ASP. It was nice to use one of my preferred languages once again.

The problem in question is very interesting. Part of the project involves using another ActiveX within the one I’m developing. Although I’m using Delphi 5, which has a good support for ActiveX, some problems became evident from the beginning.

The first thing I had to solve was a problem with message routing to the ActiveX. It turned out that IE intercepts all messages related to the keyboard, and if the ActiveX needs to respond to accelerator keys, it needs to insert itself in IE’s message loop using a procedure which involves implementing a simple interface. I hadn’t faced this problem before because I developed few ActiveX components in my programming career and none had another ActiveX hosted within itself.

The next issue was related with Delphi’s dependence on the application message loop. As an ActiveX is hosted by another application, it has its own isolated message loop, which precluded the use of some Delphi components that were not properly designed to operate inside an ActiveX.

I faced another problems when I had to read parameters from the HTML page hosting the ActiveX. Delphi doesn’t provide direct support, but after some searching, I found out that it was as easy as implementing another simple interface which could be used to read those parameters.

At last, but not at least, I faced a problem with dialog boxes, which remains unsolved until now. Delphi has components that wrap around Windows dialog boxes providing a simple and common interface for them. Again, the implementation assumes that the dialog box wrappers will be used in a full-fledged application. The final result is that IE loses its focus for a few moments after a dialog box is closed. From what I could find, the problem can only be solved if I modify the source code of one of Delphi’s libraries which will cause collateral effects. I’m still undecided about what I will do.

All in all, the day was very productive and pleasant. To tell the truth, it’s the very existence of those problems, and sometimes the pressure to solve them, that makes programming so interesting. Without a certain amount of trouble, programming would be too boring. It’s the challenges I live for.

Comments are closed.

What's this?

You are currently reading A programmer’s day at Reflective Surface.

meta