Page 1 of 1

[SOLVED] how add own message?

Posted: Sun Apr 27, 2008 9:33 am
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

Posted: Sun Apr 27, 2008 11:03 am
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.

Posted: Sun Apr 27, 2008 6:44 pm
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?

Posted: Sun Apr 27, 2008 6:50 pm
by ABBKlaus
if you replace message with msg it should work :wink:

Posted: Sun Apr 27, 2008 8:07 pm
by nicolaus
ABBKlaus wrote:if you replace message with msg it should work :wink:
ups you are right! i must go sleep