Dotnet plugin: An interesting problem I'd like advice on.
Posted: Wed Nov 07, 2012 6:13 am
I drag my plugin onto the MSIcode window.
The first call the bridge makes is to DesignTimeEdit. The arguments are the window handle, state, newState and displayDialog. Ignore the handle. The state and newState arguments are both null strings and displayDialog is true. When returning on the first call if the value I want to return is "Fred Was Here" I'd set the return value of DesignTimeEdit to 13 which is the length of the string. Control then passes back to the bridge, etc. Notice that on the first call you can only give back the length of the string and not the string itself.
The bridge then makes a second call to DesignTimeEdit. Again, ignore the handle. The state and newState arguments are still null strings but this time, the displayDialog is false. The next thing you do is give back the string "Fred Was Here". In our example, I'd set newState = "Fred Was Here". That works.
But notice that between the calls the string "Fred Was Here" is no longer available in the second. I guess this is because the calls are not in the same process as each other. I got round this by creating a text file in the plugin's installation folder and I write "Fred Was Here" to it. On the second call I then read the text and give that back to the newState argument.
My question really is if there is some way of preserving the string I need to return on the second call without writing it to a file or burying it in the registry. Serialising the string doesn't help because you still need to write an external file. I'm looking for some way to hold it in memory. I've Googled all the variations I can think of but there's nothing really useful.
It's interesting to note that the default IA Dotnet plugin template uses a constant string value so it doesn't have the same problem. I won't have a problem when building or installing a setup as the plugin uses totally different methods; only the IDE interaction is the issue.
Any ideas?
The first call the bridge makes is to DesignTimeEdit. The arguments are the window handle, state, newState and displayDialog. Ignore the handle. The state and newState arguments are both null strings and displayDialog is true. When returning on the first call if the value I want to return is "Fred Was Here" I'd set the return value of DesignTimeEdit to 13 which is the length of the string. Control then passes back to the bridge, etc. Notice that on the first call you can only give back the length of the string and not the string itself.
The bridge then makes a second call to DesignTimeEdit. Again, ignore the handle. The state and newState arguments are still null strings but this time, the displayDialog is false. The next thing you do is give back the string "Fred Was Here". In our example, I'd set newState = "Fred Was Here". That works.
But notice that between the calls the string "Fred Was Here" is no longer available in the second. I guess this is because the calls are not in the same process as each other. I got round this by creating a text file in the plugin's installation folder and I write "Fred Was Here" to it. On the second call I then read the text and give that back to the newState argument.
My question really is if there is some way of preserving the string I need to return on the second call without writing it to a file or burying it in the registry. Serialising the string doesn't help because you still need to write an external file. I'm looking for some way to hold it in memory. I've Googled all the variations I can think of but there's nothing really useful.
It's interesting to note that the default IA Dotnet plugin template uses a constant string value so it doesn't have the same problem. I won't have a problem when building or installing a setup as the plugin uses totally different methods; only the IDE interaction is the issue.
Any ideas?