when I leave my database I want to stop running a global Function

G

Guest

When I close the database, I would like to stop this function, as it modifies
windows dirrectly. I only need this function to while in the database, and
when I close it I would Like to have the function cease. The way it is set
up now, this function starts when you first open the database, but the
effects are still there when I close the database. I will be using a single
form to exit the database every time. Can anybody help me with this?

Here is the global code that I am using:
Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal
lpvParam As Any, ByVal fuWinIni As Long) As Long

Sub disable(blnDisable As Boolean)

result = SystemParametersInfo(97, blnDisable, CStr(1), 0)

End Sub
 
R

Ron Hinds

Looking in the MSDN library, the flag you are using with this function says
"Applications should not call the function with this flag set". So I don't
know what it accomplishes. But just as a guess, I would say that if you call
your function (disable) in your form's Close event, and pass it the opposite
of whatever flag it is passed when your app starts, it *should* reverse the
setting. For instance, if your Form_Open (or possibly Form_Load) calls
disable(True) then in the Form_Close event you should call disable(False),
and vice-versa.
 

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