Problem Postmessage

Windows specific forum
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Problem Postmessage

Post by Nico »

Here the code:
I have two messages if compiled on x86 and one message if compiled on x64

Code: Select all

If OpenWindow(1, 0, 0, 800, 640, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

    ListViewGadget(0,10,10,780,580)
    ButtonGadget(1,10,600,100,20,"Test")
    myMessage = RegisterWindowMessage_(@"My.App.Message.1")

   

    Repeat
        Event = WaitWindowEvent()
        Select Event
          Case #PB_Event_Gadget
            Select EventGadget()
              Case 1
                 PostMessage_(#HWND_BROADCAST,myMessage,12,24)
            EndSelect
            
            Case #PB_Event_CloseWindow
                Quit = #True
            Case myMessage
                msg$ = "STRING MESSAGE (RegisterWindowMessage): "
                AddGadgetItem(0,-1,msg$+Str(Event)+" ($"+Hex(Event)+") - wParam: "+Str(EventwParam())+" ($"+Hex(EventwParam())+") - lParam: "+Str(EventlParam())+" ($"+Hex(EventlParam())+")")
        EndSelect
    Until Quit = #True
EndIf
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Problem Postmessage

Post by Polo »

Shouldn't you use a callback to receive such messages?
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Problem Postmessage

Post by luis »

Polo wrote:Shouldn't you use a callback to receive such messages?
According to the documentation yes, in practice at least under windows you can see a widespread use of windowevent in the forum to read directly windows messages too. -> http://www.purebasic.fr/english/viewtop ... 32#p402232

Anyway, I get one message in both cases (x86 / x64).
"Have you tried turning it off and on again ?"
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

Re: Problem Postmessage

Post by buddymatkona »

I got one message with PB 5.0 x64 but two messages using 5.11 Beta 1 x64.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Problem Postmessage

Post by luis »

buddymatkona wrote:I got one message with PB 5.0 x64 but two messages using 5.11 Beta 1 x64.
He didn't mention the version in the bug report so I thought it would be nice to do the same, ah! :)

Anyway I'm using the 5.10 final, that could explain it.
"Have you tried turning it off and on again ?"
Fred
Administrator
Administrator
Posts: 18360
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Problem Postmessage

Post by Fred »

You should use a callback for this.
Post Reply