Active and Selected are two completely different things. Active just means that the node has the focus, such as what it gains when you right-click the node. Selected means that the node has been left-clicked at some point. To select a node programmatically, just use the following:
After doing this - indeed the "selected" image appears to the left of the tree node (from the ImageList index used when creating the node) but, the actual text of the node is not "highlighted. IE: the folder opens, but the folder name is not highlighted.
This is even more obvious when working with a ListView. I've selected a particular ListViewItem, but no rectangular, reverse color block around the text of the item appears onscreen.
Maybe I am doing something wrong - or missing something? Without the highlighted text, its not really obvious which element has been selected.
Out of curiousity, does the rectangular marquee (the dotted lines) around the text appear? If so, the TreeView no longer seems to have the focus. Set TreeView.HideSelection to false and see if the rectangular selection region is at least gray (or whatever the default system color for inactive selected text is).
Which is why I've been trying to get Catalyst to understand that in a separate thread. I mean, if you can't even understand environment variables, why would anyway think to tackle COM? That's like trying to climb Everest or K2 without making it up the front steps to the lobby (if it has one?)!
If you want to do things this way, you must create an IDL file (don't use headers and don't worry about compiling to a DLL) and import additional IDL files when necessary. Interface documentation should list what IDL file they are found in. If not, check for a similar IDL file that matches the name of the header file (filename.h to filename.idl).
Heath Stewart wrote: Take a look at the following CP article which gives an example of how to go from IDL files -> midl.exe -> typelib -> tlbimp.exe -> interop assembly: Using MSHTML Advanced Hosting Interfaces[^].
You beat me to it, I was looking for the link to that article to post a reply and thought I would check to see if you had posted a reply yet.
First, add the paths to your INCLUDE enviroment variable and you won't have to worry about paths.
Second, no, you shouldn't include the interface information - they're already defined you're just forward-defining them.
There's plenty of information about IDL in the PSDK. You should read some of that. Also, just do what the author did in the article that I linked. He does everything you need to do, just with different IDL files, interfaces, and structs.
You've never done any C/C++? The INCLUDE environment variable is a user- or system-environment variable that includes a semi-colon delimited list (colon-delimited in *nix) of directories where header files (or, in this case, IDL files) are located. You can set this in VS, too, but then it only applies to the VS environment instead of all applications (if an application is open, you'll have to restart it after setting the env. var.).