calling_20object_20methods_20using_20structures
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
calling_20object_20methods_20using_20structures [2018/03/31 13:19] – external edit 127.0.0.1 | calling_20object_20methods_20using_20structures [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Calling object methods using structures===== | =====Calling object methods using structures===== | ||
- | //by Richard Russell, March 2007//\\ \\ Calling **COM**, **OLE** or **ActiveX** object //methods// generally involves the use of a rather arcane syntax, such as this example taken from the BB4W manual under [[http:// | + | //by Richard Russell, March 2007//\\ \\ Calling **COM**, **OLE** or **ActiveX** object //methods// generally involves the use of a rather arcane syntax, such as this example taken from the BB4W manual under [[http:// |
+ | |||
+ | <code bb4w> | ||
SYS !(!gpp%+24), | SYS !(!gpp%+24), | ||
SYS !(!gpp%+28), | SYS !(!gpp%+28), | ||
- | Here it is not at all clear what methods are being called, and how, hence the need for comments.\\ \\ It is possible to improve the clarity considerably by using a **structure** to represent the object. You can then call the object' | + | </ |
+ | |||
+ | Here it is not at all clear what methods are being called, and how, hence the need for comments.\\ \\ It is possible to improve the clarity considerably by using a **structure** to represent the object. You can then call the object' | ||
+ | |||
+ | <code bb4w> | ||
SYS IPicture.get_Width%, | SYS IPicture.get_Width%, | ||
SYS IPicture.get_Height%, | SYS IPicture.get_Height%, | ||
- | To make this work you need to declare a structure containing all the object' | + | </ |
+ | |||
+ | To make this work you need to declare a structure containing all the object' | ||
+ | |||
+ | <code bb4w> | ||
DIM IPicture{QueryInterface%, | DIM IPicture{QueryInterface%, | ||
\ get_Type%, get_Width%, get_Height%, | \ get_Type%, get_Width%, get_Height%, | ||
\ SelectPicture%, | \ SelectPicture%, | ||
\ PictureChanged%, | \ PictureChanged%, | ||
- | To complete the process we must point the structure at the object' | + | </ |
- | | + | |
- | The memory originally allocated when the structure was created is wasted, but this isn't a problem if it is declared as a **LOCAL** structure.\\ \\ As a practical illustration of the use of this technique here is a replacement for the **PROCdisplay** routine listed in the BB4W manual:\\ \\ | + | To complete the process we must point the structure at the object' |
+ | |||
+ | <code bb4w> | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The memory originally allocated when the structure was created is wasted, but this isn't a problem if it is declared as a **LOCAL** structure.\\ \\ As a practical illustration of the use of this technique here is a replacement for the **PROCdisplay** routine listed in the BB4W manual: | ||
+ | |||
+ | <code bb4w> | ||
DEF PROCdisplay(picture$, | DEF PROCdisplay(picture$, | ||
LOCAL iid{}, IPicture{}, oleaut32%, olpp%, gpp%, hmw%, hmh%, picture%, res% | LOCAL iid{}, IPicture{}, oleaut32%, olpp%, gpp%, hmw%, hmh%, picture%, res% | ||
Line 37: | Line 55: | ||
IF gpp% = 0 ERROR 100, " | IF gpp% = 0 ERROR 100, " | ||
- | | + | |
SYS IPicture.get_Width%, | SYS IPicture.get_Width%, | ||
Line 49: | Line 67: | ||
SYS " | SYS " | ||
ENDPROC | ENDPROC | ||
+ | </ |
calling_20object_20methods_20using_20structures.1522502347.txt.gz · Last modified: 2024/01/05 00:18 (external edit)