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. application messaging

application messaging

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
7 Posts 5 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.
  • K Offline
    K Offline
    Krauze
    wrote on last edited by
    #1

    I'm currently coding on a project where I need to post a user-defined message together with a LPCWSTR parameter. But I don't know how to achieve that coz you know, PostMessage() only provides parameters typed as WPARAM and LPARAM. Anyone could help? Many thx in advance.

    L 1 Reply Last reply
    0
    • K Krauze

      I'm currently coding on a project where I need to post a user-defined message together with a LPCWSTR parameter. But I don't know how to achieve that coz you know, PostMessage() only provides parameters typed as WPARAM and LPARAM. Anyone could help? Many thx in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Cast[^] your string to LPARAM and do the reverse at the receiving end.

      The best things in life are not things.

      B C 2 Replies Last reply
      0
      • L Lost User

        Cast[^] your string to LPARAM and do the reverse at the receiving end.

        The best things in life are not things.

        B Offline
        B Offline
        barneyman
        wrote on last edited by
        #3

        but be aware that if your string is transient ((new'd and delete'd) or stack based), it'll possibly be corrupt at the other end if you PostMessage it ...

        L D 2 Replies Last reply
        0
        • B barneyman

          but be aware that if your string is transient ((new'd and delete'd) or stack based), it'll possibly be corrupt at the other end if you PostMessage it ...

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I'm well aware of that. However, if the OP is not aware of casting then I doubt he'll be into something as advanced as new and delete. ;)

          The best things in life are not things.

          1 Reply Last reply
          0
          • L Lost User

            Cast[^] your string to LPARAM and do the reverse at the receiving end.

            The best things in life are not things.

            C Offline
            C Offline
            Code o mat
            wrote on last edited by
            #5

            Let's hope both the sending and receiving end is in the same process-space.

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<

            1 Reply Last reply
            0
            • B barneyman

              but be aware that if your string is transient ((new'd and delete'd) or stack based), it'll possibly be corrupt at the other end if you PostMessage it ...

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              barneyman wrote:

              but be aware that if your string is transient ((new'd and delete'd) or stack based), it'll possibly be corrupt at the other end if you PostMessage it ...

              How so? In order to pass strings from one thread to another using PostMessage(), new and delete are highly recommended.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

              B 1 Reply Last reply
              0
              • D David Crow

                barneyman wrote:

                but be aware that if your string is transient ((new'd and delete'd) or stack based), it'll possibly be corrupt at the other end if you PostMessage it ...

                How so? In order to pass strings from one thread to another using PostMessage(), new and delete are highly recommended.

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

                B Offline
                B Offline
                barneyman
                wrote on last edited by
                #7

                true; got 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