Article View: borland.public.delphi.opentoolsapi
Article #175Re: Manipulate Library and Browsing Path
From: Aleksander Oven
Date: Tue, 06 May 2008 08:43
Date: Tue, 06 May 2008 08:43
57 lines
3623 bytes
3623 bytes
David Novo wrote: > If you can share how you programatically installed/uninstalled design > time IDE packages, that would be great. Sharing the code is not something I can do, sorry. I can share the idea behind the code, though. As many people before me have already determined, there's currently no official way of installing and uninstalling the packages from within an IDE expert. So after careful consideration I decided to embark on a difficult, trial-and-error-ridden path of simulating user input. In a nutshell, this is what's required: - Locate the action object that belongs to the "Component|Install packages" menu item, and execute it - Locate the list box component on the form that opens - Locate the "Add", "Remove" and "OK" buttons on that same form - Loop the list box items, calling "Remove" button's OnClick event handler for each item - Execute the "Add" button's OnClick event handler for every new package to install - Confirm the changes by executing "OK" button's OnClick handler In reality, it was much more complicated, because initial action can open different forms with different control structure and layout, depending on whether there is a project open or not, and the type of the active project (package/exe/dll). Additionally, IDE pops up a dialog for every package about to be removed. In order to hide that dialog, I had to figure out which API was called (different on XP/Vista) and patch it with my own, which only returned IDYES. Similar thing when installing packages - I had to patch the TOpenDialog.Execute() so that it didn't really open the dialog, but simply filled in the FileName property. Oh, and that whole library path manipulation thing I initially asked about? It turned out modifying paths through the official interfaces didn't persist the changes. So I had to go through the UI for this, too. All in all, it took me 2 months or so of work, and I still have some quirks to iron out (e.g. all other expert's shortcut key overrides stop working after I run the expert). But it works pretty well in the end, and that's what matters to me. :) I'm aware I'll have to redo some of the UI-dependent things for Delphi 2008, but that's ok, since my users won't be switching to that version for some months after it becomes available, so there'll be plenty time. I probably haven't made anyone reading this too happy, but I still hope it was helpful in some way. :) -- Regards, Aleksander Oven
Technical Details
Message-ID:
<48201a4c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!217.73.144.45.MISMATCH!feeder2.ecngs.de!ecngs!feeder.ecngs.de!news.isoc.lu!newsgroups.borland.com!not-for-mailReferences:
<47d9ba55$1@newsgroups.borland.com> <47d9c867@newsgroups.borland.com> <47d9d6eb$1@newsgroups.borland.com> <47fc464c@newsgroups.borland.com> <481e4bfb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10c3df,6a838016c843289 X-Google-Attributes: gid10c3df,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 06 May 2008 10:43:56 +0200 From: Aleksander Oven <aleksander.oven@email.si> User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: borland.public.delphi.opentoolsapi Subject: Re: Manipulate Library and Browsing Path References: <47d9ba55$1@newsgroups.borland.com> <47d9c867@newsgroups.borland.com> <47d9d6eb$1@newsgroups.borland.com> <47fc464c@newsgroups.borland.com> <481e4bfb$1@newsgroups.borland.com> In-Reply-To: <481e4bfb$1@newsgroups.borland.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 84.255.195.222 Message-ID: <48201a4c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1210063436 84.255.195.222 (6 May 2008 01:43:56 -0700) Lines: 57 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!217.73.144.45.MISMATCH!feeder2.ecngs.de!ecngs!feeder.ecngs.de!news.isoc.lu!newsgroups.borland.com!not-for-mail