VBS關閉當前框架問題
作者:金字塔 來源:cxh99.com 發布時間:2017年05月24日
- 咨詢內容:
在以下代碼中,for循環內通過Application.SendMessage(57602)或者Application.PostMessage(57602)來關閉當前框架時,經常未能成功,特別是操作多個框架時,請問是什么問題?為了避免失去鼠標焦點問題,我還特意在循環里面加了ShowWindow和ActivateFrame來保證選中金字塔主程序和當前框架,但是依然無果。如果把Application.SendMessage(57602)放在循環之外,即先打開所有框架處理完后,再逐個關閉框架,則可正常關閉所有框架,但是這樣勢必會增加資源占用,導致金字塔崩潰。我現在想要做的操作就是,逐一打開各個框架,打開一個框架后處理完馬上關掉這個框架,再打開下一個框架處理完再馬上關掉。。。
[此貼子已經被作者于2017/3/28 16:35:10編輯過]
- 金字塔客服:
set list = CreateObject("System.Collections.ArrayList")
frameArray = Array("f1", "f2", "f3")
frameNum = UBound(frameArray) + 1
for i = 0 to frameNum - 1
set frame = Application.ActivateFrame(frameArray(i))
gridNum = frame.GridCount
for j = 0 to gridNum - 1
set grid = frame.GetGridByIndex(j)
if grid.FormulaCount = 2 then
set formula = grid.GetFormulaByIndex(1)
a = formula.GetBufData("info", formula.DataSize-1)
list.Add a
end if
next
Application.ShowWindow(3)
Application.ActivateFrame(frameArray(i))
Application.SendMessage(57602)
next
list.Clear
set list = nothing
set frame = nothing
set grid = nothing
set formula = nothing
- 用戶回復:
.
[此貼子已經被作者于2017/3/28 16:43:36編輯過]
- 網友回復:
set list = CreateObject("System.Collections.ArrayList")
frameArray = Array("f1", "f2", "f3")
frameNum = UBound(frameArray) + 1
for i = 0 to frameNum - 1
set frame = Application.ActivateFrame(frameArray(i))
gridNum = frame.GridCount
for j = 0 to gridNum - 1
set grid = frame.GetGridByIndex(j)
if grid.FormulaCount = 2 then
set formula = grid.GetFormulaByIndex(1)
a = formula.GetBufData("info", formula.DataSize-1)
list.Add a
end if
next
Application.ShowWindow(3)
Application.ActivateFrame(frameArray(i))
Application.SendMessage(57602)
next
list.Clear
set list = nothing
set frame = nothing
set grid = nothing
set formula = nothing
以上是代碼。我去,這是什么破代碼編輯器如此反人類,還不能縮進。。。
- 網友回復:
完全沒人理?