VBS關(guān)閉當(dāng)前框架問(wèn)題
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2017年05月24日
- 咨詢(xún)內(nèi)容:
在以下代碼中,for循環(huán)內(nèi)通過(guò)Application.SendMessage(57602)或者Application.PostMessage(57602)來(lái)關(guān)閉當(dāng)前框架時(shí),經(jīng)常未能成功,特別是操作多個(gè)框架時(shí),請(qǐng)問(wèn)是什么問(wèn)題?為了避免失去鼠標(biāo)焦點(diǎn)問(wèn)題,我還特意在循環(huán)里面加了ShowWindow和ActivateFrame來(lái)保證選中金字塔主程序和當(dāng)前框架,但是依然無(wú)果。如果把Application.SendMessage(57602)放在循環(huán)之外,即先打開(kāi)所有框架處理完后,再逐個(gè)關(guān)閉框架,則可正常關(guān)閉所有框架,但是這樣勢(shì)必會(huì)增加資源占用,導(dǎo)致金字塔崩潰。我現(xiàn)在想要做的操作就是,逐一打開(kāi)各個(gè)框架,打開(kāi)一個(gè)框架后處理完馬上關(guān)掉這個(gè)框架,再打開(kāi)下一個(gè)框架處理完再馬上關(guān)掉。。。
[此貼子已經(jīng)被作者于2017/3/28 16:35:10編輯過(guò)]
- 金字塔客服:
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
- 用戶(hù)回復(fù):
.
[此貼子已經(jīng)被作者于2017/3/28 16:43:36編輯過(guò)]
- 網(wǎng)友回復(fù):
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
以上是代碼。我去,這是什么破代碼編輯器如此反人類(lèi),還不能縮進(jìn)。。。
- 網(wǎng)友回復(fù):
完全沒(méi)人理?