以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  VBS关闭当前框架问题  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=149790)

--  作者:lyh27557496
--  发布时间:2017/3/28 16:33:15
--  VBS关闭当前框架问题
在以下代码中,for循环内通过Application.SendMessage(57602)或者Application.PostMessage(57602)来关闭当前框架时,经常未能成功,特别是操作多个框架时,请问是什么问题?为了避免失去鼠标焦点问题,我还特意在循环里面加了ShowWindow和ActivateFrame来保证选中金字塔主程序和当前框架,但是依然无果。如果把Application.SendMessage(57602)放在循环之外,即先打开所有框架处理完后,再逐个关闭框架,则可正常关闭所有框架,但是这样势必会增加资源占用,导致金字塔崩溃。我现在想要做的操作就是,逐一打开各个框架,打开一个框架后处理完马上关掉这个框架,再打开下一个框架处理完再马上关掉。。。
[此贴子已经被作者于2017/3/28 16:35:10编辑过]

--  作者:lyh27557496
--  发布时间:2017/3/28 16:38:11
--  
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
--  作者:lyh27557496
--  发布时间:2017/3/28 16:42:08
--  

.

[此贴子已经被作者于2017/3/28 16:43:36编辑过]

--  作者:lyh27557496
--  发布时间:2017/3/28 16:43:20
--  

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

以上是代码。我去,这是什么破代码编辑器如此反人类,还不能缩进。。。


--  作者:lyh27557496
--  发布时间:2017/3/30 9:59:45
--  
完全没人理?
--  作者:王锋
--  发布时间:2017/3/30 10:04:00
--  
后面版本我们计划增加关闭框架的函数,请耐心等待一下