[AccessD] Alias Question

Arthur Fuller fuller.artful at gmail.com
Mon Dec 20 05:20:13 CST 2021


That makes sense, stuart. Thanks.

On Sun, Dec 19, 2021 at 10:57 PM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> Or you want different capitalisation to match your naming conventions.:
>
> Declare Function GETDESKTOPWINDOW Lib "user32" ALIAS "GetDesktopWindow" ()
> As Long
> Declare Function getdesktopwindow Lib "user32" ALIAS "GetDesktopWindow" ()
> As Long
>
>
> On 20 Dec 2021 at 13:53, Stuart McLachlan wrote:
>
> > Two possibilities:
> > 1. If you want to abbreviate a long name, or
> > 2. If the original name of a function contains characters that are
> > illegal in a function name in your development enviornment e.g.:
> > DECLARE FUNCTION LegalName ALIAS "Illegal$Name" ... DECLARE FUNCTION
> > LegalName ALIAS "3IllegalName" ... DECLARE FUNCTION LegalName ALIAS
> > "_IllegalName" ...
> >
> >
> > On 19 Dec 2021 at 22:04, Arthur Fuller wrote:
> >
> > > The past that I am not understanding is why I would want to rename a
> > > function unless it had a really long name that was a hassle to type.
> > >
> > > On Sun, Dec 19, 2021 at 7:37 PM Stuart McLachlan
> > > <stuart at lexacorp.com.pg> wrote:
> > >
> > > > It's also worth noting that in VBA, you don't need an ALIAS if you
> > > > don't rename the function:
> > > >
> > > > Declare Function GetDesktopWindow Lib "user32" () As Long
> > > > ...
> > > > Debug.Print GetDesktopWindow
> > > > ...
> > > >
> > > > --
> > > > Stuart
> > > >
> > > >
> > > > On 19 Dec 2021 at 18:31, Arthur Fuller wrote:
> > > >
> > > > > Thanks Gary and Stuart. That clears things up.
> > > > >
> > > > > On Sun, Dec 19, 2021 at 5:53 PM Gary Kjos <garykjos at gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Here us Stuarts earlier long response Arthur.....
> > > > > >
> > > > > > On Sun, Dec 19, 2021 at 2:46 PM Stuart McLachlan
> > > > > > <stuart at lexacorp.com.pg> wrote:
> > > > > > >
> > > > > > > It is the exact name of the function as the it appears in
> > > > > > > the DLL. You
> > > > > > can declare the
> > > > > > > function with any function name you want in your code, but
> > > > > > > you must give
> > > > > > the correct actual
> > > > > > > name, with correct capitalisation, as it appears in the
> > > > > > > function as the
> > > > > > ALIAS because that is
> > > > > > > how your code finds it in the DLL.
> > > > > > >
> > > > > > > In your example, the actual exported function n the DLL is
> > > > > > > called
> > > > > > GetDesktopWindow (not
> > > > > > > captialization).
> > > > > > >
> > > > > > > You could call get the Desktop WIndow handle with hWNd =
> > > > > > > GetWinNAme() if
> > > > > > you declared
> > > > > > > your function like this:
> > > > > > > Declare Function myGetWInName _
> > > > > > > Lib "user32" Alias "GetDesktopWindow" () As Long
> > > > > > >
> > > > > > > If you did this (note incorrect capitalization), calling
> > > > > > > your function
> > > > > > would give an error since
> > > > > > > their is no such function in the DLL.
> > > > > > > Declare Function WM_apiGetDesktopWindow _
> > > > > > > Lib "user32" Alias "Getdesktopwindow" () As Long
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 19 Dec 2021 at 13:30, Arthur Fuller wrote:
> > > > > > >
> > > > > > > > Given a function declaration such as this(from ADH, by
> > > > > > > > Getz et. al.): <code> Declare Function
> > > > > > > > WM_apiGetDesktopWindow _ Lib "user32" Alias
> > > > > > > > "GetDesktopWindow" () As Long </code>
> > > > > > > >
> > > > > > > > What purpose does the Alias serve?
> > > > > > > >
> > > > > > > > --
> > > > > > > > Arthur
> > > > > > > > --
> > > > > > > > AccessD mailing list
> > > > > > > > AccessD at databaseadvisors.com
> > > > > > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > > > > > Website: http://www.databaseadvisors.com
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > AccessD mailing list
> > > > > > > AccessD at databaseadvisors.com
> > > > > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > > > > Website: http://www.databaseadvisors.com
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Gary Kjos
> > > > > > garykjos at gmail.com
> > > > > > --
> > > > > > AccessD mailing list
> > > > > > AccessD at databaseadvisors.com
> > > > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > > > Website: http://www.databaseadvisors.com
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Arthur
> > > > > --
> > > > > AccessD mailing list
> > > > > AccessD at databaseadvisors.com
> > > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > > Website: http://www.databaseadvisors.com
> > > > >
> > > >
> > > >
> > > > --
> > > > AccessD mailing list
> > > > AccessD at databaseadvisors.com
> > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > Website: http://www.databaseadvisors.com
> > > >
> > >
> > >
> > > --
> > > Arthur
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> >
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
Arthur


More information about the AccessD mailing list