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. Visual Basic
  4. Strange PostMessage Problem

Strange PostMessage Problem

Scheduled Pinned Locked Moved Visual Basic
csharphelpquestion
2 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.
  • W Offline
    W Offline
    WalthamstowBoyInSydney
    wrote on last edited by
    #1

    Hi, I'm having a strange problem trying to postmessage out of VB.NET. I have PostMessage defined as

    Public Declare Function PostMessage \_
            Lib "user32" \_
            Alias "PostMessageA" \_
                    (ByVal hwnd As IntPtr, \_
                     ByVal wMsg As Long, \_
                     ByVal wParam As Long, \_
                     ByVal lParam As Long) As Long
    

    The wMsg is arriving perfectly at hwnd, but wParam is always 0 and even stranger is lParam is always equal to the value that should be in wParam :confused: :confused: The wParam is defined as a long and has the value 10 when posting, lParam is defiend as Long and has the value Me.Handle.ToInt64() When the message arrives, though wParam = 0 and lParam = 10 Any ideas? This is driving me mad! Many thanks in advance Mark

    Richard DeemingR 1 Reply Last reply
    0
    • W WalthamstowBoyInSydney

      Hi, I'm having a strange problem trying to postmessage out of VB.NET. I have PostMessage defined as

      Public Declare Function PostMessage \_
              Lib "user32" \_
              Alias "PostMessageA" \_
                      (ByVal hwnd As IntPtr, \_
                       ByVal wMsg As Long, \_
                       ByVal wParam As Long, \_
                       ByVal lParam As Long) As Long
      

      The wMsg is arriving perfectly at hwnd, but wParam is always 0 and even stranger is lParam is always equal to the value that should be in wParam :confused: :confused: The wParam is defined as a long and has the value 10 when posting, lParam is defiend as Long and has the value Me.Handle.ToInt64() When the message arrives, though wParam = 0 and lParam = 10 Any ideas? This is driving me mad! Many thanks in advance Mark

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      In VB6, Long was a 32-bit integer. In VB.NET, Long is a 64-bit integer, and Integer is the 32-bit integer. Unless you're working on a 64-bit version of Windows, you need to use 32-bit integers:

      Public Declare Function PostMessage _
      Lib "user32" _
      Alias "PostMessageA" _
      (ByVal hwnd As IntPtr, _
      ByVal wMsg As Integer, _
      ByVal wParam As Integer, _
      ByVal lParam As Integer) As Integer


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      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