Passing ByRef or ByVal

  • Thread starter Thread starter Just Me
  • Start date Start date
J

Just Me

Public Declare Auto Function SendMessageRef Lib "user32.dll" Alias

"SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal

wParam As Integer, ByRef lParam As PARAFORMAT2) As Integer



PARAFORMAT2 is a structure that SendMessage will return stuff in.

Is the ByRef correct or since only a pointer is being passed should it be

ByVal?



Suppose I was passing data rather then receiving it,

would that change the answer to the above?



Thanks in advance
 
* " Just Me said:
Public Declare Auto Function SendMessageRef Lib "user32.dll" Alias

"SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal

wParam As Integer, ByRef lParam As PARAFORMAT2) As Integer

PARAFORMAT2 is a structure that SendMessage will return stuff in.

Is the ByRef correct or since only a pointer is being passed should it be

Pass it 'ByRef'.
 
Just Me said:
Public Declare Auto Function SendMessageRef Lib "user32.dll" Alias

"SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal

wParam As Integer, ByRef lParam As PARAFORMAT2) As Integer



PARAFORMAT2 is a structure that SendMessage will return stuff in.

Is the ByRef correct or since only a pointer is being passed should it be

ByVal?



Suppose I was passing data rather then receiving it,

would that change the answer to the above?



Thanks in advance
As you multiposted this same question to the C# group, please see my
response there.
 
Back
Top