-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathActiveXDemo.ahk
More file actions
47 lines (43 loc) · 1.19 KB
/
ActiveXDemo.ahk
File metadata and controls
47 lines (43 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
SetBatchLines, -1
Window := new CActiveXDemo("ActiveXDemo")
#include <CGUI>
Class CActiveXDemo Extends CGUI
{
;Add an ActiveX control, subclass style!
Class ie
{
static Type := "ActiveX"
static Options := "w800 h600"
static Text := "Shell.Explorer"
__New(GUI)
{
this.Navigate("http://www.google.com")
}
NavigateComplete2(GUI, pDisp, URL)
{
if(InStr(URL, "google")) ;Prohibit using google :D
this.Navigate("http://www.microsoft.com")
}
}
;Alternatively, define it as class property. Comment subclass above and uncomment code below then
;~ ie := this.AddControl("ActiveX", "ie", "w800 h600", "Shell.Explorer")
__New(title)
{
this.Title := Title
;Calling functions of the ActiveX control is done directly on the control object.
;~ this.ie.Navigate("http://www.google.com")
this.DestroyOnClose := true
this.Show()
}
;ActiveX control events are implemented like regular events of other controls
;~ ie_NavigateComplete2(pDisp, URL)
;~ {
;~ if(InStr(URL, "google")) ;Prohibit using google :D
;~ this.ie.Navigate("http://www.microsoft.com")
;~ }
PostDestroy()
{
if(!this.Instances.MaxIndex()) ;Exit when all instances of this window are closed
ExitApp
}
}