ofirg
asked on
protection fault on VB Menu
I have a form wich contain menu with the following items:
File
Open
Save
I also have a timer that call the property mnuFile.Visible = False
The problem is that if I press the File
and then place the mouse on the Open/Save sub menus, I have a "Protection Fault" the minute the timer call it's property.
How do I solve it?
File
Open
Save
I also have a timer that call the property mnuFile.Visible = False
The problem is that if I press the File
and then place the mouse on the Open/Save sub menus, I have a "Protection Fault" the minute the timer call it's property.
How do I solve it?
I couldnt reproduce it either
actually i found where i could get an error...if i had the menu open and then when file disappeared, if I tried to move the mouse while file was missing it would crash the program.
Hi
Sorry, if I don't understand question, but what's about:
Private Sub mnuFile_Click ()
Timer1.Enabled = False
End Sub
Cheers
Sorry, if I don't understand question, but what's about:
Private Sub mnuFile_Click ()
Timer1.Enabled = False
End Sub
Cheers
I was able to reproduce the Fault in VB5. By calling PopupMenu before hiding the menu stops the crash:
Option Explicit
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub mnuFile_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
PopupMenu mnuFile
mnuFile.Visible = False
Timer1.Enabled = False
End Sub
Option Explicit
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub
Private Sub mnuFile_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
PopupMenu mnuFile
mnuFile.Visible = False
Timer1.Enabled = False
End Sub
ASKER
The PopUpMenu opens all the time
and as a meter of fact have nothing to do with the problem!
Sorry.
and as a meter of fact have nothing to do with the problem!
Sorry.
ASKER
This question has a deletion request Pending
This question no longer is pending deletion
Can you post the code you are using?
It is unusual to hide a menu while it is opened, if in fact this is what you are doing.
Without knowing more about what you are trying to do, everyone is speculating.
Perhaps you noticed the menu popup all the time because you did not disable the timer once the menu was hidden.
Private Sub Timer1_Timer()
PopupMenu mnuFile
mnuFile.Visible = False
'Disable timer
Timer1.Enabled = False
End Sub
It is unusual to hide a menu while it is opened, if in fact this is what you are doing.
Without knowing more about what you are trying to do, everyone is speculating.
Perhaps you noticed the menu popup all the time because you did not disable the timer once the menu was hidden.
Private Sub Timer1_Timer()
PopupMenu mnuFile
mnuFile.Visible = False
'Disable timer
Timer1.Enabled = False
End Sub
ASKER
Ok... let us be more specific.
How can I refresh the menu with API call
I think this will close all the open sub
menus.
How can I refresh the menu with API call
I think this will close all the open sub
menus.
i tried the popup menu option that Erick posted and it closed the submenus for me...only thing to change is to allow for the File menu option to become visible again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I noticed you have a duplicate question open regarding MDI menus. If your menu appears on the MDIMain form, you have to cancel that dropdown by calling:
Call SendMessage(MDIForm1.hwnd, WM_CANCELMODE, 0, 0)
Call SendMessage(MDIForm1.hwnd,
ASKER
Cool! the menu refresh did help!
Joy and Happiness...
Joy and Happiness...
ET: more input, more input