iDispatch Properties and Methods

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > Data types and variables > iDispatch variables >

iDispatch Properties and Methods

 

What are Object properties or methods?

 

These are the two basic characteristics of an Object:

1.you can see a property as the data storage of an Object

2.you can see a method as an internal function call to do something with the data.

 

How to use Object properties or methods?

 

Object Properties or Methods can be specified explicitly giving the Property or Method name or calculated at run-time using $() string interpolation

 

Explicit

uses "Console"

 

dim oShell as iDispatch

 

printl "Creating a Shell.Application object"

 

oShell = NewCom("Shell.Application")

 

if IsComObject(oShell) Then

 

  printl "Now minimizing all windows, waiting for 2 seconds and then UndoMinimizeALL"

  

  oShell.MinimizeAll

  sleep 2000

  oShell.UndoMinimizeALL

  

  oShell = Nothing

 

Else

 

  printl "It was not possible to create Shell.Application object"

 

end If

 

printl "---Press a key to finish---"

WaitKey

 

Interpolation

uses "Console"

 

dim oShell as iDispatch

 

printl "Creating a Shell.Application object"

 

oShell = NewCom("Shell.Application")

 

if IsComObject(oShell) Then

 

  printl "Now minimizing all windows, waiting for 2 seconds and then UndoMinimizeALL"

  

  oShell.$("MinimizeAll")

  sleep 2000

  oShell.$("UndoMinimizeALL")

  

  oShell = Nothing

 

Else

 

  printl "It was not possible to create Shell.Application object"

 

end If

 

printl "---Press a key to finish---"

WaitKey