473,772 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing ByRef or ByVal

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

"SendMessag e" (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 1358

" Just Me" <ne********@a-znet.com> wrote in message
news:uZ******** *****@TK2MSFTNG P11.phx.gbl...
Public Declare Auto Function SendMessageRef Lib "user32.dll " Alias

"SendMessag e" (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

"SendMessag e" (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******** *****@TK2MSFTNG P11.phx.gbl...
Public Declare Auto Function SendMessageRef Lib "user32.dll " Alias

"SendMessag e" (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
16845
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 Class
39
7664
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 indicate: a) That I don't know enough b) Passing arguments by ref is bad
3
6613
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 ByVal and modify it, the original string doesn't change. If I pass it ByRef it does. This makes it seem like the actual type (reference or value) that is being passed is irrelevant and that only the ByVal or ByRef keyword matters. Is this...
12
6905
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 Array Variable values are calculated in the function. Calling procedure receives the values preferably into variables of the same
4
1680
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
10273
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 application. The sub loadValueByVal takes the argument by value so after returning to calling method, the object should be unchanged but it is not Public Class ITest Private MyName As String Public TestId As String Public Sub New()
11
8131
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 number) which is the last line of the following sub routine: ' procedure modifies elements of array and assigns ' new reference (note ByVal) Sub FirstDouble(ByVal array As Integer()) Dim i As Integer
4
52794
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
5934
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 them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.