ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Additional thread in VB in Excel (https://www.excelbanter.com/excel-programming/300730-additional-thread-vbulletin-excel.html)

Sverre

Additional thread in VB in Excel
 
Hi

I have a VB-code in excel, witch calls a shell function
that starts an .exe file. The exe file launches in a
separate DOS-window, and does a lot of calculation,
before it finally dies, and the message "Done. Press any
key to Terminate" appears on the bottom of the DOS-
window. (Witch is actually a lie, because you have to
close the window manually to make it disappear) The DOS-
window uses approximately 3 hours to finish, and during
that time, the rest of the VB-program is in a while loop,
checking if the DOS-window is still active. When all the
calculations are done, the program reads the results from
a file stored on disk.

My problem is that during the calculation, the program
seems to "hang". It's in a while loop, just waiting for
the DOS-window to close. I need to be able to use the
rest of the program while the DOS-calculation is active,
and when the calculations are done, it should
automatically get the results and visualize them.

I have figured out two possible ways to solve this. The
best would be if I could start a paralell thread that
checked every minute if the calculations are done. When
they are done, it visualizes them, before the thread dies.

The other way is a lot less attractive, but might be the
only way. I need to be able to close the DOS-window
completely when the calculations are done, not just
ending the program that is calculating, but also closing
it's window, and then send a message to the
user "Calculation complete". It would be a lot better
than it is now, but not as good at the first one.

The calculation program is coded in C++, and I can edit
that code too, if necessary.

Thanks for all answers/help/new ideas!


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com