Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Why can't I see my controls.

I'm working on a gentic algorithm for school.
When I start the evolution (the main part after reading in the data) everything turns white in the dialog.

I think, maybe my algorithm runs too long, but I call UpdateData(FALSE) so it should update the controls, but I can't see anything.
The controls only awake when the algorithm finished.

But as the algorithm last too long I atleast want to see where it is right now, but without controls?

Thank you for your help in forward.

Comments

  • adrianxwadrianxw Posts: 127Member
    : I'm working on a gentic algorithm for school.
    : When I start the evolution (the main part after reading in the data) everything turns white in the dialog.
    :
    : I think, maybe my algorithm runs too long, but I call UpdateData(FALSE) so it should update the controls, but I can't see anything.
    : The controls only awake when the algorithm finished.
    :
    : But as the algorithm last too long I atleast want to see where it is right now, but without controls?
    :
    : Thank you for your help in forward.
    :

    Sounds to me like you are running your algorithm in the main windows loop thus preventing your application from processing any message until your algorithm finishes. This is poor design. Run your algorithm in a seperate thread and send update messages as necessary to your main thread, in that way, the GUI will continue to run whilst your algorithm is running.

    It also sounds to me like you are using MFC. I don't use MFC, just the raw API. I know you can thread within MFC but don't know how.

    Med venlig hilsen,

    Adrian...

  • KriszKrisz Posts: 4Member
    : : I'm working on a gentic algorithm for school.
    : : When I start the evolution (the main part after reading in the data) everything turns white in the dialog.
    : :
    : : I think, maybe my algorithm runs too long, but I call UpdateData(FALSE) so it should update the controls, but I can't see anything.
    : : The controls only awake when the algorithm finished.
    : :
    : : But as the algorithm last too long I atleast want to see where it is right now, but without controls?
    : :
    : : Thank you for your help in forward.
    : :
    :
    : Sounds to me like you are running your algorithm in the main windows loop thus preventing your application from processing any message until your algorithm finishes. This is poor design. Run your algorithm in a seperate thread and send update messages as necessary to your main thread, in that way, the GUI will continue to run whilst your algorithm is running.
    :
    : It also sounds to me like you are using MFC. I don't use MFC, just the raw API. I know you can thread within MFC but don't know how.
    :
    : Med venlig hilsen,
    :
    : Adrian...
    :
    :

    I tried the following:
    Created a thread and waited for it to terminate, then destroyed it in the begining of the loop. But it didn't help I still can't tell how many cicles the loop has made.

    I supposed that while the main program is waiting for the thread to finish, it's OnDraw (or whatever) function would be called by windows, but this never happend.

    The loop runs for 30 min, I must always now how many cicles it has made.

    Thank you for your help.
  • adrianxwadrianxw Posts: 127Member
    : : : I'm working on a gentic algorithm for school.
    : : : When I start the evolution (the main part after reading in the data) everything turns white in the dialog.
    : : :
    : : : I think, maybe my algorithm runs too long, but I call UpdateData(FALSE) so it should update the controls, but I can't see anything.
    : : : The controls only awake when the algorithm finished.
    : : :
    : : : But as the algorithm last too long I atleast want to see where it is right now, but without controls?
    : : :
    : : : Thank you for your help in forward.
    : : :
    : :
    : : Sounds to me like you are running your algorithm in the main windows loop thus preventing your application from processing any message until your algorithm finishes. This is poor design. Run your algorithm in a seperate thread and send update messages as necessary to your main thread, in that way, the GUI will continue to run whilst your algorithm is running.
    : :
    : : It also sounds to me like you are using MFC. I don't use MFC, just the raw API. I know you can thread within MFC but don't know how.
    : :
    : : Med venlig hilsen,
    : :
    : : Adrian...
    : :
    : :
    :
    : I tried the following:
    : Created a thread and waited for it to terminate, then destroyed it in the begining of the loop. But it didn't help I still can't tell how many cicles the loop has made.
    :
    : I supposed that while the main program is waiting for the thread to finish, it's OnDraw (or whatever) function would be called by windows, but this never happend.
    :
    : The loop runs for 30 min, I must always now how many cicles it has made.
    :
    : Thank you for your help.
    :

    Why are you waiting for it to finish? Surely, you want the algorithm thread and the GUI thread to be running at the same time, then when you send an update message from the worker thread to the GUI thread, the GUI thread is willing and able to process it and update your controls.

    I know a good deal about threading, but sadly, as I said before, nothing about MFC.

    Med venlig hilsen,

    Adrian...

Sign In or Register to comment.