Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. To dispatch messages of main thread in OnReceive(...) procedure of CAsyncSocket derived class

To dispatch messages of main thread in OnReceive(...) procedure of CAsyncSocket derived class

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    erkanina
    wrote on last edited by
    #1

    I have a client application which playbacks remote video files time-synchronous. I used CAsyncSocket derrived class for TCP/IP transaction. In order to display video frames time-synchronous I have to place "Sleep(...)" method in OnReceive(...) procedure. But "Sleep(...)" method blocks message processing of main thread in specified time-period, so the application is not responding the mouse and keyboard events or responding with 30-40 second delay. Because the socket generating messages heavily. So, I used PeekMessage(.....), TranslateMessage(...),DispatchMessage(...) in specified time-period instead of Sleep(...) method in order to proceed messages during waiting period. It is working correctly. I filtered a lot of message that may be dangerous to dispatch in OnReceive(...) procedure. Everything seems OK. The mouse and keyboard messages are being handled correctly. But I noticed a strange behaviour; there is a drop-down list box in the main window. Normally, the selected item of drop-down list box should change when mouse pointer comes over (without clicking). But it is not working. Selected item (blue printed item) does not change when mouse pointer comes over. I thing, It is dispatching all messages except some socket messages in OnReceive(...) procedure. What may cause this problem. Does anyone have an idea. Thanks. Erkan Ermis Erkan Ermis

    I 1 Reply Last reply
    0
    • E erkanina

      I have a client application which playbacks remote video files time-synchronous. I used CAsyncSocket derrived class for TCP/IP transaction. In order to display video frames time-synchronous I have to place "Sleep(...)" method in OnReceive(...) procedure. But "Sleep(...)" method blocks message processing of main thread in specified time-period, so the application is not responding the mouse and keyboard events or responding with 30-40 second delay. Because the socket generating messages heavily. So, I used PeekMessage(.....), TranslateMessage(...),DispatchMessage(...) in specified time-period instead of Sleep(...) method in order to proceed messages during waiting period. It is working correctly. I filtered a lot of message that may be dangerous to dispatch in OnReceive(...) procedure. Everything seems OK. The mouse and keyboard messages are being handled correctly. But I noticed a strange behaviour; there is a drop-down list box in the main window. Normally, the selected item of drop-down list box should change when mouse pointer comes over (without clicking). But it is not working. Selected item (blue printed item) does not change when mouse pointer comes over. I thing, It is dispatching all messages except some socket messages in OnReceive(...) procedure. What may cause this problem. Does anyone have an idea. Thanks. Erkan Ermis Erkan Ermis

      I Offline
      I Offline
      igor1960
      wrote on last edited by
      #2

      Selected item (blue printed item) does not change when mouse pointer comes over It maybe processed in IsDialogMessage()... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

      E 1 Reply Last reply
      0
      • I igor1960

        Selected item (blue printed item) does not change when mouse pointer comes over It maybe processed in IsDialogMessage()... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

        E Offline
        E Offline
        erkanina
        wrote on last edited by
        #3

        Dear 40 years old friend, I should effected you much enough. I am afraid you are going to fall in love with me. You can not measure neither my programming ability nor famous cafcassian dig. You are above 40 and still here. Tragic,,, It must be very stressfull. You should be unemployed or you are earning below 6000$ per month. Get relax proceed some far-east practices like yoga, meditation etc. It will work, trust me.

        E 1 Reply Last reply
        0
        • E erkanina

          Dear 40 years old friend, I should effected you much enough. I am afraid you are going to fall in love with me. You can not measure neither my programming ability nor famous cafcassian dig. You are above 40 and still here. Tragic,,, It must be very stressfull. You should be unemployed or you are earning below 6000$ per month. Get relax proceed some far-east practices like yoga, meditation etc. It will work, trust me.

          E Offline
          E Offline
          erkanina
          wrote on last edited by
          #4

          It was a great misunderstand, I noticed now. You should change your signature. Sorry for trouble and misunderstand. Thanks for your interest and response. And do not take care my former message. It is not my native language. So trouble comes from it.

          I 1 Reply Last reply
          0
          • E erkanina

            It was a great misunderstand, I noticed now. You should change your signature. Sorry for trouble and misunderstand. Thanks for your interest and response. And do not take care my former message. It is not my native language. So trouble comes from it.

            I Offline
            I Offline
            igor1960
            wrote on last edited by
            #5

            And what is your f-ing problem? What 40 years have to do with your question and my answer? $6000/month? Idiot: +/-$6000 is usual for 5 minutes off my stock account fluctuations. Now: you get back to work -- sun is high enough... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups