Actually.. In theory in VB you could create a new control extender, pass the button to the VB application and have it assign the 'object' to the extender object and gain access to its events that way. In theory. I am sure there is a way in C++ too. The biggest issue is that the application you 'attach' it to needs to do the attaching, since even if you tied the object to a window, the programs code would have no idea what to do with it. However, this does bring up the interesting concept that you could say, attach an icon or image, updated by the original application, to another window. Even toolbars possibly, though that is trickier. Your original application would control it and handle most events, but its would appear/disappear along with the program you attached it to as a parent.
Now.. The thing I am not too certain of is what happens if the 'parent' gets closed? It could a) crash your program, b) hang the 'parent', since it can't be released by that windows program, c) crash both, d) crash everything. Until you actually try it, it would be rather hard to say. However, since it is now the 'child' of the program you attached it to, the program may send it a 'terminate' or 'close' event anyway, so you could maybe catch that event and kill the object, thus avoiding the possible problems (assuming the object doesn't recieve the event and terminate itself anyway, or recieves it at all). It would be a rather interesting and bizarre experiment. |