why menus from tray notification icons don’t go away

I was looking at the documentation for TrackPopupMenuEx() today and saw this in the remarks section.  This, I suspect, explains a lot of frustration I have experienced in the past. To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise,…


IOleCommandTarget, CGID_MSHTML and ActiveX controls

If you write an application that hosts the WebBrowser Control, and you want the control to do something, you can send commands to mshtml via the IOleCommandTarget interface. However, if you are an ActiveX control and you want to send CGID_MSHTML commands, you may try something like this:     …    IOleCommandTarget *pCommandTarget = NULL;    hr…


on getting IOleCommandTarget wrong (and a bit in the middle about ActiveX controls)

IOleCommandTarget is very useful.  It provides a generic way of sending commands between objects.  IE makes extensive use of IOleCommandTarget, both publically and internally.  And, like IUnknown, people frequently get it wrong. Each command is composed of a GUID (Command Group Identifier) and a DWORD (Command Identifier).  First, what is wrong with this code: HRESULT CFoo::Exec(const GUID…


on 64 bit data conversion, comctl32 and reading the documentation

Question: What is wrong with this code? case WM_DRAWITEM:{   LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT) lParam;   COMBOBOXEXITEM cbexItem = {0};   cbexItem.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;   cbexItem.iItem = pdis->itemID;    CallWindowProc(pfnOldWndProc, hwnd, CBEM_GETITEM, 0, (LPARAM)&cbexItem);   …} Answer: It will break on 64 bit machines. This is just one example of a well-known issue.  ComboBoxEx makes frequent use of -1 when asking for the item…


on IObjectWithSite, IOleObject and ActiveX controls

ActiveX® controls frequently need to communicate with their containing object.  For example, a control may want to QueryService for the cached InternetSecurityManager object to decide whether or not to take a particular action.  Controls can obtain a pointer to their containing object (also called the object’s site) in one of at least two ways.  The…


how do i uninstall ie7 beta preview?

(I get a lot of e-mails asking this question.) Click Start -> Control Panel -> Add or Remove Programs -> Check the Show update box at the top of the dialog -> Scroll down and click Internet Explorer 7 Beta 2 Preview -> Click Remove. The answers to this question and more can also be found…


laying blame where blame is due

At home, I have three computers.  The first is my workstation which is used primarily for web browsing with Internet Explorer, reading E-Mail and RAS-ing to work. The second is my Media Center PC which is used for watching TV (I love it when those video drivers cause blue screens, but that’s another story). The…


on pop-ups

I get a lot of e-mails from Internet Explorer users asking why they still get pop-ups even though they have turned on the Pop-up Blocker.  Barring user error, there are three possible reasons discussed below. Note: I will discuss several Pop-up Blocker settings.  These settings can be accessed from Tools->Pop-up Blocker->Pop-up Blocker Settings. Reason: You…


leaked IE7 builds

There are some builds floating around the net that claim to be the IE7 Beta 2 Preview release.  These are not offical released builds and are not supported.  You should be extremely cautious about installing such a build.  I would recommend not installing it at all, since you cannot easily trust that the bits have…


lazowska says the sky is falling

Ed Lazowska, in his capacity as cochair of the Presidents Information Technology Advisory Committee says “there is a looming security crisis, and the government, vendors and CIOs aren’t doing enough to stop it,” in this interview with cio. (Full disclosure: I am taking his class this quarter.)