> about the effects. > Currently i implemented a check to block paralell processing of the > script. But if i could have a new instance of the script with a new > set of static variables, there wouldn't be any problem, if PowerPro > can remember the script-instance related to the current dialog. > > It's not so important for me, because i can block paralell > processing. It's just the idea of improving things, but only if they > don't get to difficult.
As I understand the issue, you have one script which you are using as a callback with the dialog plugin. Somehow, you provide the same callback script in two different contexts, and the contexts each have unique, independent data which you are currently storing in static varaibles in the common callback script. Maybe two different dialog windows are open? The first probablem is that you cannot use statics. You need to use something created by the instance of the script that can then be identified and recalled. Locals won't work since there is no way identify them. You need a structure, most likely. The second problem is that when your script is called, you need to know which structure to use. You wanted a unique structure for each context of the callback. The standard answer that Windows API uses in similar situations is that it provides the capability, when creating the callback, to specify a parameter which passed back to the callback routine. This would often be a pointer to a structure (in your case, containing control and language info). An example is enumwindows. If Alan does not want to implement anything like this, then you may be able to fake it by storing state information (e.g. the name of the structure) in a hidden control in the dialog. Then when the script is called, it would query this hidden variable to get the structure to be used using the window handle which I think Alan gives in his callback. (Or if you wanted to get fancy, you could use the dll plugin and setwindowlog(GWL_USERDATA) to access the window data associated with the dialog but this might require some trickery since I think all you get is 32 bits -- it would have to index an array of structures or something like that).
