Re: oject returned by plugin
| Newsgroups | gmane.comp.windows.power-pro |
|---|---|
| Message-ID | <[email protected]> |
** repost to fix typos in previous version Just to get you started, some basics, assuming I understand what you want correctly. Your plugin must register a signature with registersig. Your signature should be three characters, at least one of which is less than hex 0x20. I recommend the second character be the one that is less than 0x20..The second cannot be 0x06 but any other value less than 0x29 will do. Error check registersig return value to make sure you are not conflicting with other plugins which have already registered signature you want to use. I am pretty sure all the ones that I wrote use 0x06 as second character. Your plugin will return handles to powerpro and work with handles as arguments in plugin calls. Handles are stored in variables by the script written in ppro. Handles are used to call on plugin services from the script. The script does not look at the actual value of the handle (it could, but it has no use for the value except in calling the plugin. But what exactly is a handle? A handle is a ppro string that follows a specified format: handles start with your signature bytes as registered and then can have any string of 8-bit characters, terminated by the first 0x00. In the plugin, you use that string to somehow manage the data structures you create. Possibly you could keep a table mapping strings your create (eg 8 digit numbers) to the object pointers returned by Windows if you are working with com objects. Or you could process those object pointers to remove 00 bytes, eg by inserting an escape sequence, and then use that resulting string in your handle. (See eg the class plugin which does that in the remove00 function in plugin source file class.c) You will need to understand how powerpro frees local variable to make sure you free the associated Windows memory for the object. See the help section on registering signatures. I must say, I did not think anyone would be trying to write a plugin at this stage!