|
TypeLib Browser 2.05 TypeLib browser and code generator for PowerBASIC
|
||
|
The TypeLib Browser is a tool designed to let you to examine the contents of COM servers and ActiveX controls and to provide alternate ways to use them or to give workarounds to features still not available in the Power Basic compilers, such events sink. Besides letting you to inspect all the information available in the typelibs, it generates wrapper functions that use direct VTable calls. If the Ansi strings box is checked, the functions will include code to automatically convert string parameters to Unicode and returned string values to Ansi. Checking the Check null pointers box the browser will add code to check if pthis is null and exit the function or procedure with an error code of %E_POINTER (&H80004003). This will protect you from GPFs caused by null pointers. If the DLL code box is checked, the wrapper functions will be aliased and exported, and the declares will be also aliased and include the name of the DLL (the Prefix is used as the name; change it if needed with a find and replace operation in your editor). If the Automation box is checked, information for dual interfaces will be shown in the treeview using the IDispatch interface view instead of the VTable view. If the Add enum prefix box is checked, the name of the enumerations are added to the constants. This is useful to avoid conflicts between different enumerations having one or more members with the same name that other enumerations. Double click the wanted typelib in the ListView to retrieve the information. Click the Code button to generate the wrapper functions. Please note that if the Use globals box is checked, the functions will use a global variable, <Prefix>_HRESULT, to store the result code and, if the DLL box is also checked, two additional functions <Prefix>Error and <Prefix>Result are generated. This option isn't intended for general use, but to make wrappers that can be tweaked to make them easier to use. The Proto declares and the CALL DWORD must remain unaltered, but the function header and the rest of the code can be modified. If you have chosen to build a DLL, to use it you will need to generate the declares with the MenugCodegDeclares option and save them to a file. If the component fires events, you can generate code for events sink with the MenugCodegEvents options. If there are more than one events interface, a dialog allows to select all of them or check the ones that you want. The generated class allows to sink events of multiple instances of the same control; they are differentiated by the cookie, which is the address of the address of the virtual table of the generated class and that is passed as pCookie to all the event functions. The pthis of the control is saved in the virtual table of the class and retrieved in each function. You can use it to call methods and properties of the control if you use prototypes or wrapper functions, or you can convert it to a dispatch variable using TB_MakeDispatchVariant (included in TB_COM32.INC) and use PB Automation. To advise and unadvise from events sink use the generated ConnectEvents/DisconnectEvents functions. The events code uses HeapAlloc to allocate memory for the virtual table of the class and HeapFree to release it. When you call the <Prefix>_ConnectEvents function the reference counter is incremented and when you call the <Prefix>_DisconnectEvents it is decremented. If the reference counter is zero the memory is freed. To avoid memory leaks or GPFs, each call to ConnectEvents must be matched with a call to DisconnectEvents (using the cookie returned in the call to ConnectEvents). A good place to call the ConnectEvents function is the %WM_INITDIALOG (if you are using DDT) or %WM_CREATE (if you are using SDK) messages. To call the <Prefix>_DisconnectEvents, a good place is the %WM_DESTROY message. If you use this method, you can avoid the use of global variables storing the cookies in static variables in the main dialog callback (DDT) or main window procedure (SDK).
|
|
|
|
Other options
|
||
|
The Code menu contains the following options:
ADODBRecordset15_get_State(lpRecordset, plObjState)
To hr
b) If you have dimed lpRecordset as ADODBConnectionVtbl Ptr: Call Dword @@lpRecordset.get_State Using _
AdoRecordset15_get_State(lpRecordset,
plObjState) To hr Call Dword @lpRecordset.@lpVtbl.get_State Using _
AdoRecordset15_get_State(lpRecordset,
plObjState) To hr Structures: Generates declarations for all the structures (if any) in the form TYPE/END TYPE.
Typedefs: Generates a list of all the typedefs (if any) in the form of macros.
PB-like interfaces: These interfaces are not intended to duplicate the functionality provided by the Power Basic COM Browser, but to allow to use components that it refuses because don't have a ProgID, such Accessibility (OLEACC.DLL), or can't be found in the registry, such TypeLib Information (TLBINF32.DLL).
DispiDs: Generates equates with the DispID values in the form of %DispID_<Interface name>_<method/property name>.
Offsets:
Generates equates with the VTable offsets in the form of
%VTO_<Prefix><Interface name>_<method/property name>. A list of the
|
||
|
Other notes
|
||
|
The MenugOpen option allows to load typelibsor DLLs, OCXs or EXE
files containing a typelibfrom disk. This is only useful when the
typelib is not registered.
|
||
|
Important notes
|
||
|
Some components, such Excel, have methods with more than 31
parameters, that together with the pthis parameter exceed the
maximum of 32 parameters allowed by the PowerBasic compiler. These
functions will need to use another technique, such calling DispCallFunc.
CASE %WM_SYSCOMMAND
|
||
|
Disclaimer
|
||
|
|
||
|
What is new in this version |
||
|
* Added a new option, "PwrDev Events". It generates events code suitable to be used with this the PwrDev visual designer.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Page last updated on Saturday, 04 November 2006 00:15:31 +0100
|
||