Page 1 of 1

Problem Postmessage

Posted: Sat Mar 09, 2013 6:07 pm
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

Re: Problem Postmessage

Posted: Sat Mar 09, 2013 6:19 pm
by Polo
Shouldn't you use a callback to receive such messages?

Re: Problem Postmessage

Posted: Sat Mar 09, 2013 6:37 pm
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).

Re: Problem Postmessage

Posted: Sat Mar 09, 2013 10:11 pm
by buddymatkona
I got one message with PB 5.0 x64 but two messages using 5.11 Beta 1 x64.

Re: Problem Postmessage

Posted: Sat Mar 09, 2013 10:20 pm
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.

Re: Problem Postmessage

Posted: Sun Mar 10, 2013 10:20 am
by Fred
You should use a callback for this.