Prevent user from closing form using caption close button 
Author Message
 Prevent user from closing form using caption close button

Dear all,

I try to find a solution to prevent the user to close a userform in Word97 with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander



Wed, 22 Oct 2003 02:21:20 GMT  
 Prevent user from closing form using caption close button
Hello Alexander,

Have you tried working with the hwnd for "ThunderDFrame"? That's the class
name for Forms20.



Wed, 22 Oct 2003 06:07:32 GMT  
 Prevent user from closing form using caption close button
Is the "caption close" button, the"x" in the title bar?
If so, the Userform_queryclose works in VBA just as it does in VB.

--
Please post your response to the newsgroup.

http://www.standards.com/ipusers/standards; Word macros, including
converting from WordBasic to VBA; Technical writing and reviewing; Standards
------------------------------------------------

Dear all,

I try to find a solution to prevent the user to close a userform in Word97
with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar
functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of
the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander



Wed, 22 Oct 2003 17:21:09 GMT  
 Prevent user from closing form using caption close button
Thanks for this hint, this was exactly what I was looking for.
If I had a deeper look myselfe I should have found the solution.

Anyway thanks a lot.

rgds,

Alexander

Quote:
-----Original Message-----

Is the "caption close" button, the"x" in the title bar?
If so, the Userform_queryclose works in VBA just as it does in VB.

--
Please post your response to the newsgroup.

http://www.standards.com/ipusers/standards; Word macros, including
converting from WordBasic to VBA; Technical writing and reviewing; Standards
------------------------------------------------


Dear all,

I try to find a solution to prevent the user to close a userform in Word97
with
the close button of the caption bar.
VB provides the ability to leave the close event without leaving the form by
setting the cancel parameter to true. But I'm missing a simmilar
functionality
within Word VBA

I Tried to disable the button via the API functions FindWindow("OPUSAPP",
vbnullstring), GetWindow(hwnd, GW_CHILD), GetWindow(hwnd, GW_HWNDNEXT) and
SetMenuItemInfo. The only result is that I can disable the close button of
the
main window (the word instance) instead of the modal user form.
Also a property like me.hwnd as in Access VBA is missing.

Has someone a workable solution for such a problem.

rgds,

Alexander

.



Thu, 23 Oct 2003 01:45:01 GMT  
 Prevent user from closing form using caption close button
No I haven't but the solution from Kaikow Howard solved the problem.

Thanks anyway,

Alexander

Quote:
-----Original Message-----

Hello Alexander,

Have you tried working with the hwnd for "ThunderDFrame"? That's the class
name for Forms20.

.



Thu, 23 Oct 2003 01:46:31 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to prevent user closing a mdi form using the close control button

2. problems using close [x] button when closing forms.

3. Form Close Button Does Not Close the Form

4. Preventing User from closing forms

5. Preventing the user from closing a form

6. Form does not close from the UpperRight X Close button

7. Do not close form on clicking close button in Visual Basic

8. Tip : VB.NET Form Won't Close on Me.Close + User Controls

9. Creating a window with no system menu but a close button and caption.!!HELP

10. Removing system menu and close button to prevent Exit from Word

11. Prevent Close ("X") Button under 95

12. Preventing users from closing Outlook

 

 
Powered by phpBB® Forum Software