-
Notifications
You must be signed in to change notification settings - Fork 13
/
SetFocus.nsh
70 lines (62 loc) · 1.88 KB
/
SetFocus.nsh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;----------------------------------------------------------------------------
; Title : Set focus to a control
; Short Name : SetFocus
; Last Changed : 22/Feb/2005
; Code Type : Function
; Code Sub-Type : One-way Input
;----------------------------------------------------------------------------
; Required : InstallOptions and System plugins.
; Description : Sets focus to a control using InstallOptions.
;----------------------------------------------------------------------------
; Function Call : Push "Page.ini"
; Page .ini file where the field can be found.
;
; Push "Handle"
; Page handle you got when reserving the page.
;
; Push "Number"
; Field number to set focus.
;
; Call SetFocus
;----------------------------------------------------------------------------
; Author : Diego Pedroso
; Author Reg. Name : deguix
;----------------------------------------------------------------------------
Function SetFocus
Exch $0 ; Control Number
Exch
Exch $2 ; Page Handle
Exch
Exch 2
Exch $3 ; Page INI File
Exch 2
Push $1
Push $R0
Push $R1
Push $R2
Push $R3
Push $R4
Push $R5
IntOp $1 $0 + 1199
GetDlgItem $1 $2 $1
# Send WM_SETFOCUS message
System::Call "user32::SetFocus(i r1, i 0x0007, i,i)i"
ReadINIStr $R0 "$3" "Field $0" "Left"
ReadINIStr $R1 "$3" "Field $0" "Right"
ReadINIStr $R3 "$3" "Field $0" "Top"
ReadINIStr $R4 "$3" "Field $0" "Bottom"
IntOp $R2 $R1 - $R0
IntOp $R5 $R4 - $R3
System::Call "user32::CreateCaret(i r0, i, i R2, i R5)i"
System::Call "user32::ShowCaret(i r0)i"
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
Pop $1
Pop $0
Pop $2
Pop $3
FunctionEnd