[SOLVED] how add own message?

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

[SOLVED] how add own message?

Post by nicolaus »

Hello

I have one more question.

How i can add my own message that the my gadget (from my lib) sends to the parent window of the lib?

I want send a message like WM_LBUTTONDBCLK to the callback of the parent window.

Thanks,
Nico
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

You can either construct your own messages based upon #WM_USER or #WM_APP, or use RegisterWindowMessage_() to construct a system wide unique message.

Which method you use really depends on the nature of the parent window. Some pre-registered windows classes, e.g. ListView controls (LIstICons), make use of #WM_USER for certain private messages etc. If in doubt, use RegisterWindowMessage_().

**EDIT : if you are creating a custom gadget and wish to send notifications to the parent window, then you may be better off passing a #WM_NOTIFY message.
I may look like a mule, but I'm not a complete ass.
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Post by nicolaus »

Hm...

I test it so:
in the Res file of the lib i have a constante like this one:

Code: Select all

#TLG_LBUTTONDBCLK = #WM_USER+1
Code inside the lib:

Code: Select all

SendMessage_(*tgm\hWndParent,#TLG_LBUTTONDBCLK,*tgi,0)
Code in the program

Code: Select all

Procedure MyCallBack(wnd,msg,wParam,lParam)
  Select message
    Case #TLG_LBUTTONDBCLK
      Debug "it works"
  EndSelect
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

But if i run the programm with debug it dont show the debug message if i doppelclick in the gadget.

Is my way the right one?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

if you replace message with msg it should work :wink:
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Post by nicolaus »

ABBKlaus wrote:if you replace message with msg it should work :wink:
ups you are right! i must go sleep
Post Reply