Hello all, I’m trying to write a plug-in that can do some processing to the currently selected message(s). My understanding was that for a plug-in to know anything about the UI and current selections I would have to use a menu addin, and I actually thought this would be pretty simple. I can’t get it working though, so I’m hoping someone can point me in the right direction.
I registered my addin and then when the entry is clicked I grab the NAM_COMMAND_INFO, pull out the NAM_CONTEXT_DATA, and grab its VIEWIXDATA. From the VIEWIXDATA structure, I then grab the hSelectedList and hNoteFile and use them with the IDScan function to try to get the list of selected note IDs. Things generally look ok (e.g. I get a valid DB handle), but regardless of what I have selected, IDScan only returns a note ID once, and it’s always the same value. Moreover, if I try to actually get a handle for the note (using NSFNoteOpen with the db handle and the note id) I get an error saying there is no such note.
Am I misunderstanding how to obtain the current selection, or what the hSelectedList is used for? I’m quite perplexed.
In the interest of full disclosure, I should mention that I’m actually using Delphi to create my plug-in, not C. I’ve used Delphi before for extension manager plug-ins, so I’m fairly comfortable with using Delphi to make the API calls, and I don’t think this problem is a result of that. In particular, I know that byte alignment is a concern, especially since the NAM_CONTEXT_DATA structure uses bit fields and a union, but I’ve done some sanity checks and feel pretty confident that I have the correct data in the VIEWIXDATA. For example, the DB handle seems to be correct and the reserved fields are all 0.
Thanks for any help,
Schuyler