GUI is "hang", need help. 
Author Message
 GUI is "hang", need help.

hi all,
I have one class ( SerialPort ) the is used to communicate the com
port.  Basically, it can send/receive data from the sepecific port.

however, my GUI which is single dialog based with a small progress bar
and a edit box.

The problem is that :
I call SerialPort class to send data out, and waiting for something to
come back.
While in waiting, I intend to have a progress bar to to progress. and
have "." display each loop in the edit box.

however, my GUI is hang up, and  it doesn't do anything while in the
waiting loop !
ever it can't detect user pressing the CANCEL button.

when SerialPort have received the data, then the progress bar just show
up in the full tank and edit box show up the a bunch of dot signs.

I know I can solve this problem in Visual Basic just insert DoEvent
function in the waiting loop.

how can I solve this type of problem in Visual C++ ??

Does any one has the clue to help me out ? I appreciated that.

thanks.



Mon, 20 Oct 2003 07:50:37 GMT  
 GUI is "hang", need help.

Quote:

> hi all,
> I have one class ( SerialPort ) the is used to communicate the com
> port.  Basically, it can send/receive data from the sepecific port.

> however, my GUI which is single dialog based with a small progress bar
> and a edit box.

> The problem is that :
> I call SerialPort class to send data out, and waiting for something to
> come back.
> While in waiting, I intend to have a progress bar to to progress. and
> have "." display each loop in the edit box.

> however, my GUI is hang up, and  it doesn't do anything while in the
> waiting loop !
> ever it can't detect user pressing the CANCEL button.

> when SerialPort have received the data, then the progress bar just show
> up in the full tank and edit box show up the a bunch of dot signs.

> I know I can solve this problem in Visual Basic just insert DoEvent
> function in the waiting loop.

> how can I solve this type of problem in Visual C++ ??

> Does any one has the clue to help me out ? I appreciated that.

> thanks.

While you wait in a loop your program is not accepting input
messages.  The best solution is usually to do the waiting in a
separate thread.  For a quick fix you can call the UpdateWindow()
function on the controls.  That causes them to paint while you are in
your loop.

--
Scott McPhillips [VC++ MVP]



Mon, 20 Oct 2003 08:42:24 GMT  
 GUI is "hang", need help.
hi Scott,
thank you very much, I get it done finally.

I will try to convert the class into the thread feature in the future.

anyway, thank for your help.

Jack.

Quote:


> > hi all,
> > I have one class ( SerialPort ) the is used to communicate the com
> > port.  Basically, it can send/receive data from the sepecific port.

> > however, my GUI which is single dialog based with a small progress bar
> > and a edit box.

> > The problem is that :
> > I call SerialPort class to send data out, and waiting for something to
> > come back.
> > While in waiting, I intend to have a progress bar to to progress. and
> > have "." display each loop in the edit box.

> > however, my GUI is hang up, and  it doesn't do anything while in the
> > waiting loop !
> > ever it can't detect user pressing the CANCEL button.

> > when SerialPort have received the data, then the progress bar just show
> > up in the full tank and edit box show up the a bunch of dot signs.

> > I know I can solve this problem in Visual Basic just insert DoEvent
> > function in the waiting loop.

> > how can I solve this type of problem in Visual C++ ??

> > Does any one has the clue to help me out ? I appreciated that.

> > thanks.

> While you wait in a loop your program is not accepting input
> messages.  The best solution is usually to do the waiting in a
> separate thread.  For a quick fix you can call the UpdateWindow()
> function on the controls.  That causes them to paint while you are in
> your loop.

> --
> Scott McPhillips [VC++ MVP]



Tue, 21 Oct 2003 02:22:17 GMT  
 GUI is "hang", need help.
hi Scott and all,
I add the UpdateWindow() to solve the progress bar to progress correctly.

however, the CANCEL button is still unable to detect user pressing.

how can i solve this ?

Please help.

thanks.

Quote:


> > hi all,
> > I have one class ( SerialPort ) the is used to communicate the com
> > port.  Basically, it can send/receive data from the sepecific port.

> > however, my GUI which is single dialog based with a small progress bar
> > and a edit box.

> > The problem is that :
> > I call SerialPort class to send data out, and waiting for something to
> > come back.
> > While in waiting, I intend to have a progress bar to to progress. and
> > have "." display each loop in the edit box.

> > however, my GUI is hang up, and  it doesn't do anything while in the
> > waiting loop !
> > ever it can't detect user pressing the CANCEL button.

> > when SerialPort have received the data, then the progress bar just show
> > up in the full tank and edit box show up the a bunch of dot signs.

> > I know I can solve this problem in Visual Basic just insert DoEvent
> > function in the waiting loop.

> > how can I solve this type of problem in Visual C++ ??

> > Does any one has the clue to help me out ? I appreciated that.

> > thanks.

> While you wait in a loop your program is not accepting input
> messages.  The best solution is usually to do the waiting in a
> separate thread.  For a quick fix you can call the UpdateWindow()
> function on the controls.  That causes them to paint while you are in
> your loop.

> --
> Scott McPhillips [VC++ MVP]



Mon, 27 Oct 2003 04:18:53 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ""help with TSR""

2. "MessageBox.Show(" Intellisense hang

3. "printf()" hangs machine

4. app hang at SetText("1");???????????????

5. VC 5.0 Hangs when "Generating Code..."

6. Hangs during "Launching Debugee...."

7. I am going to study "C"

8. Need help: x_windows, widgets, "sginap"??

9. Help needed with "undeclared identifier"

10. Help Needed on function "RegisterServiceProcess"

11. HELP - I need "conv3ds.exe" ( Direct3D )

12. Need help with ".wks" file format

 

 
Powered by phpBB® Forum Software