473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Quit, Close and AccessXP

Hello.

Has anybody idea, how to set off Close button on top right corner of Access
Window and set the File/Close option status acMenuGray?
I wrote my Access application and I need to control exiting of this
application. I do not have idea how to do it.

Please help me.

Coolz
Nov 12 '05 #1
1 1472
The easiest way to handle closing th eAccess app gracefully is to open a
hidden form when the application opens.

Because Access cannot close until all forms are closed you can then easily
prevent the application from closing.

When the user closes the application correctly, one of the things you do is
close this hidden form before you close the application.

The things you are asking about can be done but involves API calls and is a
bit OTT if all you want is to force a clean close down.

If you realy want to do this though heres the code for removing the control
box.
' **********************************
' Code Start
Option Explicit

Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000

Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_FRAMECHANGED = &H20
'----------------------------------

Public Function NoControlBox()
Dim hwnd As Long
Dim lngStyle As Long
Dim lngFlags As Long
Dim i As Long

lngFlags = SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_FRAMECHANGED
hwnd = hWndAccessApp
lngStyle = GetWindowLong(hwnd, GWL_STYLE)
lngStyle = lngStyle And (Not WS_SYSMENU)
i = SetWindowLong(hwnd, GWL_STYLE, lngStyle)

Call SetWindowPos(hwnd, 0&, 0&, 0&, 0&, 0&, lngFlags)
End Function
' Code Start
' **********************************

On the toolbar look at creating a custom toolbar for your application
Terry

"ktos" <kt**@cos.pl> wrote in message
news:bv**********@nemesis.news.tpi.pl...
Hello.

Has anybody idea, how to set off Close button on top right corner of Access Window and set the File/Close option status acMenuGray?
I wrote my Access application and I need to control exiting of this
application. I do not have idea how to do it.

Please help me.

Coolz

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve | last post by:
Recently due to viruses I had to wipe my harddrive and reload everything. Now, in AccessXP(2000 and XP mode) all new reports and all reports in existing databases open in Fit to Page rather than...
0
by: Bob Hynes | last post by:
Hi All, In one of my Access97 db applications I created a report which I output to a RichTextFormat file attach it to an Email and send it out, that has worked just fine for a couple of years now....
3
by: downwitch | last post by:
Greetings, I have an application which has recently gone from being one big piece of front-end code to being three, i.e. an mdb A that references an mda B and an mda C. (For what it's worth, in...
3
by: Bhavya Shah | last post by:
Hello there, I am facing a strange problem. I use office converters for converting Microsoft Word documents to html in my application. I use office automation for the entire process. I open the...
6
by: Max | last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user: Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMail...
0
by: Alan T | last post by:
I tried to close the word document object and word application: private Interop.Word.Application WordApp; private Interop.Word.Document WordDoc; // close word and quit word application ...
0
by: Roger | last post by:
I am having a problem sending email through smtp.gmail.com using smtplib. Everything works and the mail is sent and received, except quit. The following shows the problem (without bothering to...
5
by: bobh | last post by:
HI, I understand AccessXP file size has a 2 gig limit but I trying to understand the following I have a tab delimited data file that is 1.3 gigs big and I try to import it into an empty...
9
by: Andy | last post by:
Just noticed something interesting in the above. If you have your program file set to "Compact on Close" in access 2007 (which is desirable when you have a larger program that frequently needs...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.