473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Passing ByRef or ByVal

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
3 1341

" 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
* " 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andy Read | last post by:
Dear all, I thought I understood passing parameters ByVal and ByRef but I clearly don't! If I define a simple class of: Public Class Person Public Name as String Public Age as Integer End...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
3
by: Scott M. | last post by:
If I pass a reference type ByVal, am I making a copy of the object on the heap or am I making a copy of a pointer to the object on the heap? If I pass a string object (reference type) into a sub...
12
by: Dennis D. | last post by:
Hello: I want a function to return three variables to the calling procedure: Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as Integer, ByVal iAddMins as Integer) As...
4
by: Erik Foreman | last post by:
this is what I have 'variables defined as arrays Dim ceday(), ceti(), ceto(), ceproj(), cenotes() As String Dim cerow As Int32
2
by: Witold Iwaniec via .NET 247 | last post by:
It seems that when you pass an object to a function it is always passed by reference even if it is explicitly declared ByVal. Is it the behavior of VB.Net? Here is sample code from sample Asp.Net...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
4
by: Scott M. | last post by:
Does C# support passing arguments ByVal & ByRef? If so, what is the default (ByVal?)? And, if so, how do you explicitly specify either? Thanks.
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.