I've run into a hard crash bug, and I'm not 100% sure how to fix. It's been a while, and I hope you're all well.

A little background, although I'm sure I'm not telling the folks I hope to brainstorm with anything they don't know.

Each time my addin loads, I mark down the memory location of the ribbon -- it's a LongPtr in 64-bit office... but bottom line, it's the memory location in RAM associated with the ribbon UI -- and it looks something like this: 123120947574012630. This is a common practice, and I know it's not unique to my programming.

The problem is this: if a second winword process loads and writes down the memory location of the ribbon -- it overwrites the memory location of the first ribbon. And any attempt by the first winword process to reload the ribbon from the memory location causes a hard crash.

The solution seems obvious - start marking down the memory location along with the PID of the winword process (or some other identifying thing about the application), so that Winword1 only reloads Ribbon1, and Winword2 only reloads Ribbon2. The crash comes when Winword1 tries to reload Ribbon2.

But even though I can use some code to get the PID of the latest winword process when I write down the ribbon's memory location -- that still doesn't solve the problem of my code *knowing* which PID is running it.

Any ideas?