如图,关闭VC程序时就弹出(而且得点击运行窗口的关闭按钮两次才弹出),选择其中的关闭程序,程序才能正常关闭。程序中有一个按钮的响应函数是个死循环,我把循环条件startstop在关闭函数DestroyWindow和Onclose函数中设置为否,也还是如常不能一下就关闭掉。
程序如下:
void CTestDlg::Onoriginalimage()
{
// TODO: Add your control notification handler code here
while (startstop)
{
grab_image_start(AcqHandle, -1);
grab_image_async(&Image, AcqHandle, -1);
if (HDevWindowStack::IsOpen())
set_color(HDevWindowStack::GetActive(),"green");
if (HDevWindowStack::IsOpen())
set_draw(HDevWindowStack::GetActive(),"margin");
if (HDevWindowStack::IsOpen())
set_line_width(HDevWindowStack::GetActive(),3);
find_bar_code(Image, &SymbolRegions, BarCodeHandle, "auto", &DecodedDataStrings);
count_obj(SymbolRegions, &Number);
str2="";
for (k=0 ;k<=Number-1 ;k++)
str2=str2+DecodedDataStrings[k]+" ";
GetDlgItem(IDC_str)->SetWindowText(str2);
str.Format(_T("%d"),Number[0]);
GetDlgItem(IDC_string)->SetWindowText(str);
disp_obj(Image, WindowHandle);
disp_obj(SymbolRegions, WindowHandle);
}
}