hop page 4 - Dave's Blog

Search
My timeline on Mastodon

Notes on Creating Internet Explorer Extensions in C++ and COM

2009 Mar 20, 4:51

Working on Internet Explorer extensions in C++ & COM, I had to relearn or rediscover how to do several totally basic and important things. To save myself and possibly others trouble in the future, here's some pertinent links and tips.

First you must choose your IE extensibility point. Here's a very short list of the few I've used:

Once you've created your COM object that implements IObjectWithSite and whatever other interfaces your extensibility point requires as described in the above links you'll see your SetSite method get called by IE. You might want to know how to get the top level browser object from the IUnknown site object passed in via that method.

After that you may also want to listen for some events from the browser. To do this you'll need to:

  1. Implement the dispinterface that has the event you want. For instance DWebBrowserEvents2, or HTMLDocumentEvents, or HTMLWindowEvents2. You'll have to search around in that area of the documentation to find the event you're looking for.
  2. Register for events using AtlAdvise. The object you need to subscribe to depends on the events you want. For example, DWebBrowserEvents2 come from the webbrowser object, HTMLDocumentEvents come from the document object assuming its an HTML document (I obtained via get_Document method on the webbrowser), and HTMLWindowEvents2 come from the window object (which oddly I obtained via calling the get_script method on the document object). Note that depending on when your SetSite method is called the document may not exist yet. For my extension I signed up for browser events immediately and then listened for events like NavigateComplete before signing up for document and window events.
  3. Implement IDispatch. The Invoke method will get called with event notifications from the dispinterfaces you sign up for in AtlAdvise. Implementing Invoke manually is a slight pain as all the parameters come in as VARIANTs and are in reverse order. There's some ATL macros that may make this easier but I didn't bother.
  4. Call AtlUnadvise at some point -- at the latest when SetSite is called again and your site object changes.

If you want to check if an IHTMLElement is not visible on screen due how the page is scrolled, try comparing the Body or Document Element's client height and width, which appears to be the dimensions of the visible document area, to the element's bounding client rect which appears to be its position relative to the upper left corner of the visible document area. I've found this to be working for me so far, but I'm not positive that frames, iframes, zooming, editable document areas, etc won't mess this up.

Be sure to use pointers you get from the IWebBrowser/IHTMLDocument/etc. only on the thread on which you obtained the pointer or correctly marshal the pointers to other threads to avoid weird crashes and hangs.

Obtaining the HTML document of a subframe is slightly more complicated then you might hope. On the other hand this might be resolved by the new to IE8 method IHTMLFrameElement3::get_contentDocument

Check out Eric's IE blog post on IE extensibility which has some great links on this topic as well.

PermalinkCommentstechnical boring internet explorer com c++ ihtmlelement extension

Semantic Search the US Library of Congress

2009 Feb 23, 10:31"This is an experimental service that makes the Library of Congress Subject Headings available as linked-data using the SKOS vocabulary. The goal of lcsh.info is to encourage experimentation and use of LCSH on the web with the hopes of informing a similar effort at the Library of Congress to make a continually updated version available. More information about the Linked Data effort can be found on the W3C Wiki."PermalinkCommentslibrary-of-congress loc semanticweb web rdf metadata library api

"Don't forget..." - a set on Flickr

2009 Jan 13, 1:31More photos of the ad attacked with Photoshop windows.PermalinkCommentshumor art photo flickr graffiti streetart advertising street photoshop cultural-disobediance

Advertisement Gets a Street Art Photoshop Makeover | PSFK

2009 Jan 13, 1:29"A crew of artists (Mr. Tailon, Baveux Prod., Kone & Epoxy) have done up a slick pop music advertisement with a Photoshop makeover. Typical Photoshop windows have been wheatpasted over the faces of three ubiquitous top 40 music stars."PermalinkCommentshumor ad advertising streetart street art cultural-disobediance graffiti photoshop

Etre Touchy - Welcome - Gloves for your iPhone, iPod Touch, Nintendo DS, Blackberry, PDA and more...

2009 Jan 8, 5:49Gloves with the ends of the index finger and thumb missing for using phones and the like while keeping the rest of your hands warm. Good idea!PermalinkCommentsglove design shopping wishlist phone cellphone clothing gloves

20x200: Our Story

2008 Dec 29, 2:26Some interesting work in here: "On a Sunday night back in January, Jen came up with a formula: (limited editions x low prices) + the internet = art for everyone"PermalinkCommentsart gift purchase wishlist gallery online photo shop via:thefangmonster

A Young Mad Scientist's First Alphabet Blocks | Xylocopa

2008 Dec 17, 2:27"Specifically, we have noticed that there is absolutely no training in the K-6 grades that prepares students to become mad scientists. In this competitive 21st-century world, the need for mad scientists will only increase... We are pleased to announce the release of our Young Mad Scientist's First Alphabet Blocks."PermalinkCommentshumor science geek gift via:swannman shopping wishlist toy alphabet-blocks

MTV Music - User's profile

2008 Oct 29, 10:27MTV has tons of music videos online. The service has an API and everything. No more adding music video on YouTube to delicious only to have the video taken down later... hopefully.PermalinkCommentsproldfile music music-video mtv video me

Language Log - Nerdview

2008 Oct 23, 10:34Geoffrey K. Pullum of Language Log defines 'nerdview': "It is a simple problem that afflicts us all: people with any kind of technical knowledge of a domain tend to get hopelessly (and unwittingly) stuck in a frame of reference that relates to their view of the issue, and their trade's technical parlance, not that of the ordinary humans with whom they so signally fail to engage... The phenomenon - we could call it nerdview - is widespread." Woo, go year-month-day, go!PermalinkCommentsnerdview language date programming nerd writing

YouTube - CHAINSAW MAID

2008 Aug 21, 7:55Zombie claymation video featuring a maid and also a chainsaw. So much gore. Also its quite awesome. "THEY are coming for your FLESH and BLOOD! Now the last hope of the family rests on a sexy faithful MAID! The most brutal clay-animation you've ever seen!"PermalinkCommentschainsaw zombie youtube claymation video maid

TopatoCo: We Sell T-Shirts by the E-Shore

2008 Aug 6, 3:47Various shirts that are sometimes hilarious, sometimes awesome, and sometimes both at the same time.PermalinkCommentstshirt tshirts shopping comics awesome humor geek clothing

Dark Knight and Mariners Baseball

2008 Aug 4, 8:39

The weekend before last I saw Dark Knight with some friends from work and then we all ate at Z'Tejas after. Like everyone has said and as the name implies Dark Knight is... dark. Dark Knight was a little over the top at times as compared to Batman Begins but I really enjoyed it. Two times during the movie I thought it had ended but I was wrong. The Joker is both frightening (Cringe inducing line "Wanna know how I got these scars?") and humorous ("Where is Harvey Dent? ... You know where Harvey is? You know who he is?", as well as the pencil magic trick). I can certainly recommend it to anyone who enjoyed Batman Begins. The previews included Burn After Reading a new Coen Brother's comedy that I look forward to, and Quantum of Solace which hopefully does the same thing Dark Knight has, keep up the new direction on the refreshed franchise.

Safeco Field Suite photoThis past weekend Sarah and I went to a Mariners baseball game. I think this is the first MLB baseball game I've seen in person. Sarah's company gave out tickets for the game and the use of a suite. Its a room half way up the stadium with comfortable chairs, a mini-fridge built-in to the marble counter-topped center table, and a big flat screen television with the game on it. I suppose that's in case you don't want to turn to the right and sit at the window, or walk out onto the balcony which features three rows of comfy chairs overlooking the field. Anyway there was free food and drinks and I met some of the people Sarah works with.

PermalinkCommentsbaseball batman nontechnical

Cuisipro Ice Cream Scoop & Stack at Wrapables - Cooks Tools

2008 Jun 19, 3:41Its a futuristic ice cream scoop. Looks like it could go with my automatic wine uncorker =)PermalinkCommentspurchase gift food shopping design ice-cream

The Wii Fit's Mind Games

2008 Jun 19, 2:49

Wii Fit LogoSarah received her Wii Fit a few weeks ago. The Wii Fit is a game for the Wii and a balance board accessory that can tell how you're standing on it: leaning forward, standing on one foot, leaning backward and mostly on your left foot, etc. The game puts you through various exercises grouped into the categories of aerobic, balance, strength, and yoga. It also lets you set goals and keeps track of how well you do, how long you play, and a graph of your weight.

The portion I didn't expect were the mind games. Sarah turned it on after not using it for a day and it said something to the effect of 'Oh, didn't have time to exercise yesterday? Huh. Interesting....' I'm paraphrasing of course but the Wii Fit was definitely trying to lay down some guilt. In another instance when starting up the Wii Fit Sarah was asked 'Did you know that Dave has been using Wii Fit?' She selected yes and it then asked her how she thought I was progressing giving her four options. She selected the worst one, that I was getting worse (jokingly I hope) and it told her to tell me that, but not to use those words. In conversation Sarah should mention to me that I've been "living large". Now I'm not paraphrasing. It reminded me a bit of this xkcd comic 'Zealous Autoconfig'. Hopefully this is the extent of the manipulation and mind games that the Wii Fit will perform.

PermalinkCommentsxkcd wii-fit sarah guilt nontechnical wii

Amorphia Apparel - Look on my shirts, ye mighty, and despair!

2008 Jun 17, 5:52More awesome t-shirts. I like the scientist rocking out, 'Moai (All Ears)', and 'I bought this on the internet!'. Also the FAQ is pretty hilarious.PermalinkCommentsart clothing humor geek science tshirts purchase shopping shirt

Teach the Controversy - Intelligently designed t-shirts urging you to show both sides of every story

2008 Jun 17, 12:32Some of my favs: UFOs creating pyramids, a periodic table of elements consisting of 'Air', 'Water', 'Fire', etc., and satin in overalls burying fossils. I'm surprised by the lack of FSM.PermalinkCommentshumor via:boingboing satire religion science clothing shopping tshirts evolution intelligent-design

Bluelounge - The Sanctuary

2008 Jun 9, 4:44"The Sanctuary is a beautiful, simple solution to a real everyday problem. A place to put the multitude of personal items we all carry around so they are easily located again when later needed and, always fully charged"PermalinkCommentsgift gadget design cable battery phone mp3player charger shopping product

GPS Stolen

2008 Jun 6, 3:03

My GPS was stolen last night or this morning and I'm missing it already. For instance when I drove to Novus glass repair to get my front passenger window replaced I drove down the wrong road for a while.

When I got out of my apartment this morning there was a police car sitting in my parking lot and the officer asked me: "David? ... What'd you leave in your car?". My face must have changed a lot when I had the following sequence of realizations: (a) a police officer is asking for me by name, (b) I'm not in trouble, (c) my car must have been burgled, and (d) my GPS must be stolen.

The officer was waiting outside my complex because someone had reported my car's broken window to the police in the morning. The officer was very courteous and upon taking my date of birth noted that we were born on exactly the same day. The window's safety glass was shattered and lying in tons of tiny pieces all over the passenger seat, my glove box was open and the middle armrest where I keep my CDs was open. Nothing appears to be missing other than the GPS, the GPS power cable, and the GPS dash mount. Adding insult to theft, the their scattered my CDs throughout my car and didn't take any of them, insulting my taste in music.

My car's window should be repaired now and hopefully the rain that came in through the broken window until I covered it with plastic bags (classy!) didn't do any permanent damage.

PermalinkCommentsgps theft personal nontechnical

Golf Cart Parking

2008 May 28, 11:02

sequelguy posted a photo:

Golf Cart Parking

Kierland Commons shopping center next to the resort had fancy shops, hummers and golf carts.

PermalinkCommentsarizona sarah parking scottsdale golfcart kierlandcommons

Attended Savor Seattle

2008 May 13, 10:33

[Seattle's Best Coffee logo in front of Pike Place logo]This past Saturday Sarah and I took the Savor Seattle Tour of various food shops in Pikes Place. Sarah had suggested it at one point and when Jesse and Nicole brought it up again when they came up to Seattle we decided to go. Surprisingly our tour group consisted of mostly locals. Except for the fish market I hadn't been to see any of the places on the tour. I particularly enjoyed the chocolate cherries and the tea. Our tour guide Tim was funny and overall I enjoyed the tour and would recommend it. I've made a map of our tour including what free trials we got at each location. Yum!

PermalinkCommentsfood tour seattle savor seattle nontechnical
Older EntriesNewer Entries Creative Commons License Some rights reserved.