|
-
Mar 7th, 2001, 06:09 PM
#1
Thread Starter
New Member
How do I get the x (close) button in the title bar to minimize the app instead of closing.
I want the user to only be able to close the program using exit on the popup menu in taskbar.
Thanks.
-
Mar 7th, 2001, 06:56 PM
#2
Try this:
Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = True
Me.WindowState = vbMinimized
End Sub
-
Mar 7th, 2001, 07:08 PM
#3
Lively Member
Well...
Just disable the Close button in the From's properties (duh).
-AndySoft
[email protected]
[email protected] (Use the other one first!)
I use: NASM, HTML, Perl, PHP, JavaScript, Batch, TI-Basic (TI-83+), QBasic 1.1, QuickBASIC 4.5, QuickBASIC Extended 7.1, VB-WIN 6 Ent., and the rest of Visual Studio 6 Ent.  And who knows what else!
-
Mar 7th, 2001, 07:30 PM
#4
Re: Well...
Originally posted by AndySoft
Just disable the Close button in the From's properties (duh).
Yeah, but if you do that, you will lose the minimize and maximize buttons.
-
Mar 7th, 2001, 07:39 PM
#5
There is, however, an API method that will disable only the close button.
Code:
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hwnd, 0), 6, MF_BYPOSITION
End Sub
-
Mar 8th, 2001, 09:45 AM
#6
Thread Starter
New Member
Is there an API method of changing the function of that button from close to minimize...can I track the message and then process my own command when it 'hears' that particular one being called?
I know you do this to change the system popup menu to your own. I just don't know exactly how to do it...I'm new to the API stuff.
Thanks.
-
Mar 8th, 2001, 03:28 PM
#7
You don't need any API for changing the function. Just use Matthew Gate's method.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|