Carsten Kanstrup

What exactly gets posted to the message queue in case of control.Invoke or control.BeginInvoke

For example, if you have the following delegate:

Public Delegate Sub StrPtr(ByVal Buffer As string)

and then calls:

Me.BeginInvoke(New StrPtr(AddressOf MyMethod), StringBuffer)

this gets translated to a PostMessage call. This call has only four arguments: hWnd , msg, wParam and lParam, where lParam is normally used for arguments.

1) I have read somewhere that the messages, which gets posted to the message queue, are really just delegates linked together by means of the _PREV field. In that case, the method and target fields of the delegate could be used to point to MyMethod and the argument for MyMethod could be transferred in lParam. Then it also makes sense that control.Invoke/BeginInvoke has only one argument (not compiler generated like delegate.Invoke/BeginInvoke) because there is only place for one argument in the message structure (lParam), but is this true

2) If no, how does the message structure, which gets posted, looks like and where is the address of the delegate transferred - in the lParam parameter

3) What name (WM_ ) is used for msg so that WndProc can recognize it and execure the method (MyMethod)

4) Does WndProc just execute the delegate like this (in case the delegate is transferred in lParam)

Case WM_

m.lParam.Invoke



Re: Windows Forms General Control.Invoke/BeginInvoke and PostMessage

Carsten Kanstrup

Nobody knows





Re: Windows Forms General Control.Invoke/BeginInvoke and PostMessage

Carsten Kanstrup

Nothing on the Internet or in Windows Internals. Are there really nobody, who knows