Addressof in Access 2000 and newer

T

tobesurveyor

Good morning-

I am trying to incorporate Dev Ashish's code to place a form in the system's
tray in an Access 2000 application. Utilizing the code found here:
http://www.mvps.org/access/api/api0045.htm I create a form, paste the code as
specified on the website and also create a new module for the functions.
When I click on the button that is linked to the : cmdStartDemo_Click() I get
an error saying that vba332.dll can not be found for the AddrOf function.
Reading through some posts I find that vba332.dll is native to Access 97 and
that Access 2000 and greater already has AddressOf built in as a common
function. Following the steps found in another post I change the following
line of code:

lpPrevWndProc = apiSetWindowLong(frm.hWnd, _
GWL_WNDPROC, _
AddrOf(strFunction))

to

lpPrevWndProc = apiSetWindowLong(frm.hWnd, _
GWL_WNDPROC, _
AddressOf strFunction)
Unfortunately this still is causing an error on the line AddressOf
strFunction) with the error: "Expected sub, function or property".

Any help in this would be greatly appreciated.
Thanks,
Chris F.
 
D

Dirk Goldgar

In
tobesurveyor said:
Good morning-

I am trying to incorporate Dev Ashish's code to place a form in the
system's tray in an Access 2000 application. Utilizing the code
found here: http://www.mvps.org/access/api/api0045.htm I create a
form, paste the code as specified on the website and also create a
new module for the functions. When I click on the button that is
linked to the : cmdStartDemo_Click() I get an error saying that
vba332.dll can not be found for the AddrOf function. Reading through
some posts I find that vba332.dll is native to Access 97 and that
Access 2000 and greater already has AddressOf built in as a common
function. Following the steps found in another post I change the
following line of code:

lpPrevWndProc = apiSetWindowLong(frm.hWnd, _
GWL_WNDPROC, _
AddrOf(strFunction))

to

lpPrevWndProc = apiSetWindowLong(frm.hWnd, _
GWL_WNDPROC, _
AddressOf strFunction)
Unfortunately this still is causing an error on the line AddressOf
strFunction) with the error: "Expected sub, function or property".

Any help in this would be greatly appreciated.

I think the AddressOf operator requires a hard-coded procedure name;
e.g.,

AddressOf fWndProcTray
 
D

Douglas J. Steele

Ignore this: don't know what I was thinking!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Douglas J. Steele said:
The function is named AddrOf in Access 2000 and newer.
 
T

tobesurveyor via AccessMonster.com

Thanks that at an initial debugging seems to remove the error message.

Thanks,
Chris

Dirk said:
Good morning-
[quoted text clipped - 23 lines]
Any help in this would be greatly appreciated.

I think the AddressOf operator requires a hard-coded procedure name;
e.g.,

AddressOf fWndProcTray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top