ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ByVal? (https://www.excelbanter.com/excel-programming/304820-byval.html)

newbie

ByVal?
 
Can someone please explain what each of this actually does?

Private Declare Function FindWindowA& Lib "User32" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLongA& Lib "User32" _
(ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function OpenClipboard& Lib "User32" (ByVal hWnd&)
Private Declare Function EmptyClipboard& Lib "User32" ()
Private Declare Function CloseClipboard& Lib "User32" ()
Private Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte _
, ByVal bScan As Byte, ByVal dwFlags&, ByVal dwExtraInfo&)

Thanks in advance

keepITcool

ByVal?
 
These are so called API declarations to register certain functions in
operaring system libraries. For syntax and explanations see:
www.AllApi.Net

The difference re ByVal / ByRef:
if you pass a parameter ByRef the pointer (reference to memoery
address) to the original variable is passed.

ByVal: a New variable is created. the Value of the orignal variable
is then assigned to that new variable...

This not only relates to API declarations, but is the same for VBA.
(where passsing it ByREF is the default)

Search VBA hlep for ByRef and you should have a nice read.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Newbie wrote :

Can someone please explain what each of this actually does?

Private Declare Function FindWindowA& Lib "User32" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLongA& Lib "User32" _
(ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function OpenClipboard& Lib "User32" (ByVal hWnd&)
Private Declare Function EmptyClipboard& Lib "User32" ()
Private Declare Function CloseClipboard& Lib "User32" ()
Private Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte _
, ByVal bScan As Byte, ByVal dwFlags&, ByVal dwExtraInfo&)

Thanks in advance




All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com