-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWsGlobalFunctions.pkg
More file actions
116 lines (97 loc) · 3.26 KB
/
Copy pathWsGlobalFunctions.pkg
File metadata and controls
116 lines (97 loc) · 3.26 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Use Windows.pkg
Use seq_chnl.pkg
// *** Struct Declarations: ***
Struct AboutSHELLEXECUTEINFO
DWord cbSize
Integer fMask
Handle hwnd
Pointer lpVerb
Pointer lpFile
Pointer lpParameters
Pointer lpDirectory
Integer nShow
#IFDEF IS$WIN64
Integer iMissingAlignment1
#ENDIF
Pointer hInstApp
Pointer lpIDList
Pointer lpClass
Handle hkeyClass
DWord dwHotKey
#IFDEF IS$WIN64
Integer iMissingAlignment2
#ENDIF
Handle hIconMonitor // Union
//Handle hMonitor // Union
Handle hProcess
End_Struct
Define SEE_MASK_NOCLOSEPROCESS for 64 //(0x00000040)
External_Function AboutShellExecuteEx "ShellExecuteEx" Shell32.dll Pointer pExecInfo Returns Integer
External_Function AboutWaitForSingleObject "WaitForSingleObject" Kernel32.dll ;
Handle hHandle ;
DWord dwMilliseconds ;
Returns DWord
External_Function AboutCloseHandle "CloseHandle" Kernel32.dll Handle hHandle Returns Integer
// A variant of the ShellExecute Win API, but it waits until the process that is started
// (the passed program), has finished
// The DOS box does also _not_ flash briefly.
Procedure RunProgramWait Global String sProgram String sParameter
Handle hProcess
Integer iVoid
AboutSHELLEXECUTEINFO sInfo
Move (SizeOfType(AboutSHELLEXECUTEINFO)) to sInfo.cbSize
Move SEE_MASK_NOCLOSEPROCESS to sInfo.fMask
Move SW_SHOW to sInfo.nShow
Move (AddressOf(sProgram)) to sInfo.lpFile
Move (AddressOf(sParameter)) to sInfo.lpParameters
// This will "hide" the DOS box from showing (no flasing box):
Move 0 to sInfo.nShow
Move (AboutShellExecuteEx(AddressOf(sInfo))) to iVoid
Move sInfo.hProcess to hProcess
If (hProcess) Begin
Move (AboutWaitForSingleObject(hProcess, -1)) to iVoid
Move (AboutCloseHandle(hProcess)) to iVoid
End
End_Procedure
Function OpenOutput Global String sFileName Returns Integer
Integer iCh
Get Seq_New_Channel to iCh
If (iCh = DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
Error DFERR_PROGRAM "DF_SEQ_CHANNEL_NOT_AVAILABLE"
Function_Return DF_SEQ_CHANNEL_NOT_AVAILABLE
End
Direct_Output channel iCh sFileName
Function_Return iCh
End_Function
Procedure CloseOutput Global Integer iCh
Close_Output channel iCh
Send Seq_Release_Channel iCh
End_Procedure
Function OpenInput Global String sFileName Returns Integer
Integer iCh
Get Seq_New_Channel to iCh
If (iCh = DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
Error DFERR_PROGRAM "DF_SEQ_CHANNEL_NOT_AVAILABLE"
Function_Return DF_SEQ_CHANNEL_NOT_AVAILABLE
End
Direct_Input channel iCh sFileName
Function_Return iCh
End_Function
Procedure CloseInput Global Integer iCh
Close_Input channel iCh
Send Seq_Release_Channel iCh
End_Procedure
Function OpenAppendOutput Global String sFileName Returns Integer
Integer iCh
Get Seq_New_Channel to iCh
If (iCh = DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
Error DFERR_PROGRAM "DF_SEQ_CHANNEL_NOT_AVAILABLE"
Function_Return DF_SEQ_CHANNEL_NOT_AVAILABLE
End
Append_Output channel iCh sFileName
Function_Return iCh
End_Function
Procedure CloseAppendOutput Global Integer iCh
Close_Input channel iCh
Send Seq_Release_Channel iCh
End_Procedure