displaying toolbar and menu!!!

i have an SDI application with a menu and toolbars. But when i run my
program, which involves windows sockets and reads infinitely from a
specific socket, then my menu and toolbar disappear from the
window. How do i prevent this from happening?

angshuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZoppoCommented:
Hi angshu,

try implementing the socket reading loop in a thread or make anyhow sure that the window's messages sent to you main window are processed via PeekMessage()/DispatchMessage().

hope that helps,

ZOPPO
0
Gandalf32Commented:
I believe the problem is that your problem stays in a loop reading the socket, never letting the window process messages.
If this is the case, then you need to change your program in order to allow it to process messages. You can do this by eliminating the loop in the socket reading code, and instead reading the socket once during each call of the OnIdle method of the application. Otherwise, you can start a second thread (a work thread) and execute the polling code there.
0
migelCommented:
Can you be more specific? How you read socket data? Show your code
0
jzhang100Commented:
I believe this happens because your socket reading operation is in the same thread of your user interface. The socket read operation is blocking the  thread so no more message can be delivered before that socket reading API returned. When programming a socket on windows platform, it can be either in synchronized mode or asynchronized mode. The solution to your problem can be one of the following.
1. Program your socket in asyncronized mode, so that it will be blocking the thread, if you do not want to begin another thread. MFC has CAsyncSocket class for this kind of use.
2. If you really want to use synchronized read, start a seperate thread to do this.

Jenny
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jzhang100Commented:
I believe this happens because your socket reading operation is in the same thread of your user interface. The socket read operation is blocking the  thread so no more message can be delivered before that socket reading API returned. When programming a socket on windows platform, it can be either in synchronized mode or asynchronized mode. The solution to your problem can be one of the following.
1. Program your socket in asyncronized mode, so that it will not be blocking the thread, if you do not want to begin another thread. MFC has CAsyncSocket class for this kind of use.
2. If you really want to use synchronized read, start a seperate thread to do this.

Jenny
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.