By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Passing ByRef or ByVal

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

" Just Me" <ne********@a-znet.com> wrote in message
news:uZ*************@TK2MSFTNGP11.phx.gbl...
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.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 20 '05 #2

P: n/a
* " Just Me" <ne********@a-znet.com> scripsit:
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'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #3

P: n/a
Thanks to both of you.
Needed the answer ASAP and got it ASAP
" Just Me" <ne********@a-znet.com> wrote in message
news:uZ*************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.