Jump to content

Help: eVC++ 4.0


Guest puso

Recommended Posts

Hi,

I'm writing a program for smartphone 2003 device with eVC++ 4.0. The program has a simple interface that consists of couple of buttons.(I used the PUSHBUTTON type for that).

There is one IMPLEMENT button and 1 CANCEL button. If IMPLEMENT button is pressed, the program implements, I want the CANCEL button to work the job of cancelling the process if pressed. My problem is that once the IMPLEMENT btn is pressed, the screen of my device freezes, you cannot press or do anything to other btns. If you still press the other btns, it waits until the process is finished, it then implements other command.

Does anyone know a function to make the CANCEL btn work in this case? Or any suggestion is welcome.

Thanks a bunch.

Link to comment
Share on other sites

Guest Fr3323r
Hi,

I'm writing a program for smartphone 2003 device with eVC++ 4.0. The program has a simple interface that consists of couple of buttons.(I used the PUSHBUTTON type for that).

There is one IMPLEMENT button and 1 CANCEL button. If IMPLEMENT button is pressed, the program implements, I want the CANCEL button to work the job of cancelling the process if pressed. My problem is that once the IMPLEMENT btn is pressed, the screen of my device freezes, you cannot press or do anything to other btns. If you still press the other btns, it waits until the process is finished, it then implements other command.

Does anyone know a function to make the CANCEL btn work in this case? Or any suggestion is welcome.

Thanks a bunch.

<{POST_SNAPBACK}>

Seems to me that the implementing process is a blocking method.

This means that you can only do something when the 'Implementing' is finished.

You could try to build the 'Implementing' in a modelles dialog, or maybe in a thread of the current dialog.

This way you will be able to do multiple things at the same time.

Link to comment
Share on other sites

Guest nIghtorius
Hi,

I'm writing a program for smartphone 2003 device with eVC++ 4.0. The program has a simple interface that consists of couple of buttons.(I used the PUSHBUTTON type for that).

There is one IMPLEMENT button and 1 CANCEL button. If IMPLEMENT button is pressed, the program implements, I want the CANCEL button to work the job of cancelling the process if pressed. My problem is that once the IMPLEMENT btn is pressed, the screen of my device freezes, you cannot press or do anything to other btns. If you still press the other btns, it waits until the process is finished, it then implements other command.

Does anyone know a function to make the CANCEL btn work in this case? Or any suggestion is welcome.

Thanks a bunch.

<{POST_SNAPBACK}>

As with the above reply.. your "Implement" function is a blocking function.. meaning Windows CE cannot recieve messages.. and will be only recieving messages when your function stops.. you can always return "control".. if your "implement" function has a lot of iterations (like 100 of them).. you can poll the messages every 5 iterations or so. (not 10 / 15 / 20.. since the response will get sluggisch.. depending how much time a iteration takes)..

example: (quicky quicky)

void longwaitingcode () {

 int poll = 0;

 MSG msg;

 for (int i = 0; i < 1000; i++) {

   // does things.. quite cpu demanding...

  poll++;

  if (poll == 5) {

   GetMessage (&msg, NULL, 0, 0));

   TranslateMessage (&msg);

   DispatchMessage (&msg);

   poll = 0;

  }

 if (__global_cancel_button) break; // some global bool var gets true when cancel button is pressed

 }

}

this ^^ was a rough explanation of what I meant..

a better but tougher method is using threads.. this way you can execute more functions at the same time.. but things can go wrong easier.

Edited by nIghtorius
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.