473,670 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

declare a SendMessage with ByVal parameters or ByRef

I declare the following and use it if the msg returns values.

I also declare an SendMessage using ByVal for other calls.

Isn't there a way I can used the SendMessage and in the call tell it to use
ByRef?

Public Declare Auto Function SendMessageRef Lib "user32.dll " Alias
"SendMessag e" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByRef wParam As
Integer, ByRef lParam As Integer) As Integer

Thanks

PS

I once read a great internet site that explained in detail ByVal and ByRef
as applied to Value types and Reference types - but I've lost the URL.

Anyone know the address?
Nov 21 '05 #1
3 1698
> Isn't there a way I can used the SendMessage and in the call tell it to
use
ByRef?


i guess.. what message are you planning to send ?
IIRC, if the message returns you a Structure via a parameter, than you can
pass the struct variable "ByRef As MyStruct" and it should get fill
automaticaly or you can pass it "ByVal As IntPtr" and then use the
Marshal.PtrToSt ructure() function as well.

--
Best Regards
Yanick
Nov 21 '05 #2

"Zoury" <yanick_lefebvr e at hotmail dot com> wrote in message
news:OQ******** ******@TK2MSFTN GP15.phx.gbl...
Isn't there a way I can used the SendMessage and in the call tell it to

use
ByRef?


i guess.. what message are you planning to send ?

In this instance, just Integers that are to be returned
Thanks
Nov 21 '05 #3
than declare the parameter ByRef.

--
Best Regards
Yanick

" Just Me" <gr****@a-znet.com> a écrit dans le message de
news:uY******** ******@tk2msftn gp13.phx.gbl...

"Zoury" <yanick_lefebvr e at hotmail dot com> wrote in message
news:OQ******** ******@TK2MSFTN GP15.phx.gbl...
Isn't there a way I can used the SendMessage and in the call tell it to

use
ByRef?


i guess.. what message are you planning to send ?

In this instance, just Integers that are to be returned
Thanks

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
383
by: Sandy | last post by:
Hello! Help!!!! I have ten zillion books that attempt to describe the difference between ByVal and ByRef and none of them are clear to me. I have gathered that ByVal makes a copy and ByRef points to something and changes it. The default for simple data types is ByVal and for objects, it's ByRef. Am I correct so far? If so, I still don't have a clue as
7
5498
by: Hei | last post by:
Hi, i know the difference of ByRef and ByVal, in case if use byref or byval don't affect the result which one should prefer? (less memory use, better performance ....issue) thx
19
2410
by: Rob Panosh | last post by:
Hello, Ok here is the senerio: ..... Dim myArrayList as New ArrayList(0) me.Test_A( myArrayList )
4
12308
by: Carlos Gomez | last post by:
In VB6 the default for passing variables was ByRef. It was faster and used less memory. Why did MS changed that? Are there any advantages using ByVal over ByRef? (other than ByVal impeding you from changing the original variable passed)
2
12545
by: Lance Geeck | last post by:
I have many items that I lifted off from Microsoft's website several years ago. These samples were in VB6. I now want to convert an application to VB.NET. I am getting an error that says "As Any is not supported in a declare statement" during the automated Conversion process. Some examples of this are: Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory"(ByRef
16
1786
by: Richard | last post by:
Hi, I am passing a structure to a subroutine where the passed parameter has been declared as ByVal. However, changes made to the passed variable inside the subroutine flow through to the actual variable that has been passed over, even though with ByVal this should not happen. Has anybody else discovered this or am I doing completely wrong /
14
1527
by: Niklas | last post by:
Hi What I have learned is that a variable is just a reference when dealing with Objects. Are you supposed to use ByVal or ByRef in functions? They produce the same result or have I missed something? Regards /Niklas Public Class Main Shared Sub Main() Dim testPropObj As New MyPropertObject testPropObj.MyInt = 1
6
2129
by: **Developer** | last post by:
Notice below I sometimes used the "A" version. I found by cut-and-try that only the "A" version would work correctly. Anyone have a suggestion of why the "W" version would not work correctly? One reason is that the ByRef or ByVal does not show by InteliSence so the "p" would help there. ------ Secondly, I'd like to be consistent with the parameter names. I'd like to
0
923
by: Ken | last post by:
Newbie, having a problem upgrading from VB6 to dotNet. I am trying to call some subs from a NIST dll and I don't know how to call them in Net. I have used the Upgrade VB6 wizzard on my old source and got a Modual and a form. Module NIST_Module Public Declare Sub SETUPdll Lib "Refprop" (ByRef i As Integer,
0
8386
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
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
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...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
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
5686
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
4213
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...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1795
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.