WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

OLE2 Automation Tips

Keywords: OLE objectopen 

OLE2 Automation

Here is a few lines of information and a sample OLE program.

The WIL language is a "negatively typed" language. In other words, variables are not "typed". Instead, WIL will try anything to convert variables to the proper type for an operation. So if you have one variable that is equal to 1 and another variable that's equal to "5", then WinBatch is smart enough, if you want to add the two of them together, to compute a 6. Strongly typed languages, like Pascal, wouldn't let you do that.

Note that if you are running a small compiled EXE, you will need to install a copy of the WBOCC34I.DLL (for 32 bit version, version "CC"), which is the WIL OLE Interpreter DLL, in the same directory with your WinBatch EXE. The name of the file will vary, depending on the version of WinBatch you're running, and on what platform you've compiled for.

The basic Wil syntax for accessing OLE objects is:

 objectopen(progidname)
Creates an Ole Object for Ole Automation to occur.
	ObjectName=ObjectOpen("display.ccalc")

 objectclose(ObjectName)
Terminates an Ole Object.

* * *
;OLEPOLY.WBT

Red=255

Redish=127

Green=255<<8

Greenish=Green/2

Blue=255<<16

Blueish=Blue/2

c0=red+blue

c1=red+Blueish

c2=red

c3=red+greenish

c4=red+green

c5=redish+green

c6=green

c7=green+blueish

c8=green+blue

c9=greenish+blue

c10=blue

c11=blue+redish

c12=blue+red

c13=blueish+red

c14=red

CountAgain=0

:DoItAgain

chan=ObjectOpen("spoly2.cpoly")

WinZoom("IDispatch")

;goto sign

y=10

x=30

width=8

size=370

RGB=96

RGBMAX=(((255<<8)+255)<<8)+255

chan.SetXOrigin(0)

chan.SetYOrigin(0)

cindex=0

:LOOP

chan.AddPoint(x,y)

chan.AddPoint(x+size,y)

chan.AddPoint(x+size,y+size)

chan.AddPoint(x,y+size)

chan.SetWidth(width+1)

chan.SetRGB(c%cindex%)

chan.Draw()

chan.Reset()

size=size-(2*width)

x=x+width

y=y+width

cindex=cindex+1

if cindex>14 then cindex=0

if size>0 then goto loop

;;;;;;;

;Signature

:sign

;chan2=ObjectGetObject(CPoly2,0,0)

chan2=ObjectOpen("spoly2.cpoly")

chan2.SetXOrigin(420)

chan2.SetYOrigin(0)

x=10

y=10

chan2.SetWidth(2)

chan2.SetRGB(255<<16)

chan2.AddPoint(x+0,y+0)

chan2.AddPoint(x+15,y+40)

chan2.AddPoint(x+30,y+12)

chan2.AddPoint(x+45,y+40)

chan2.AddPoint(x+60,y+0)

chan2.AddPoint(x+58,y+0)

chan2.AddPoint(x+45,y+38)

chan2.AddPoint(x+30,y+10)

chan2.AddPoint(x+15,y+38)

chan2.AddPoint(x+2,y+0)

chan2.Draw()

chan2.SetXOrigin(490)

chan2.Draw()

chan2.SetXOrigin(560)

chan2.Draw()

;PlayWaveForm(0)

ObjectClose(chan)

ObjectClose(chan2)

* * *


Article ID:   W13677
Filename:   OLE2 Automation Tips.txt
File Created: 2012:08:23:09:59:00
Last Updated: 2012:08:23:09:59:00