[AccessD] Alias Question

Stuart McLachlan stuart at lexacorp.com.pg
Sun Dec 19 18:36:37 CST 2021


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
> 




More information about the AccessD mailing list