Passing ByRef or ByVal

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
 
H

Herfried K. Wagner [MVP]

* " 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'.
 
P

Peter van der Goes

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top