我有一个应用程序,它在几个地方的类调用C ++ dll来执行一些数据计算。为了在执行dll计算时不让主UI线程在应用程序标题栏上显示“Not Responding”,我将调用放入任务中的dll,然后等待它完成,因为dll处理后的所有代码都必须等待它完成。我正在尝试显示一个带有选取框进度条的表单,以便在运行时显示dll任务,然后在完成后,关闭表单。但是当我显示表单时,进度条未激活(显示但没有绿色条...只是一个空白控件)。
你如何让这个工作?它是使用.Net 4.0的Windows窗体桌面应用程序。这是代码:
Sub combos_2()
Dim combos_condition_output As Integer
' finds combinations and stores in class 2D array
combos_find2()
// displays dialog for getting matches between sets of combinations
combos_condition_output = combos_trim_input(3)
If (combos_condition_output <> -1) Then
' Form with just a label and a marquee progress bar
' Want marquee progress bar active during Task 't'
Dialog12_trim_info.Show()
Application.DoEvents()
Dim t As Task = Task.Factory.StartNew(Sub()
' calls dll to trim combinations
' according to dialog input above
combos_trim(combos_condition_output)
End Sub)
t.Wait()
' After Task completes just close form
Dialog12_trim_info.Close()
' finds matches of combinations against history of numbers...calls dll
combos_matches()
MsgBox("Finished")
' outputs results to text file
combos_output()
Else
MsgBox("Finished")
End If
End Sub
答案 0 :(得分:0)
解决方案:我必须在加载进度表单之前启用Visual Styles:
<button>1</button>
<button>2</button>
然后在任务调用之后:
var change = function() {
this.style.color = 'red';
}
window.onload = function() {
var button = document.getElementsByTagName('button');
for (var i = 0; i < button.length; i++) {
button[i].addEventListener('click', change, null);
}
}