Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Brian,
Does the active message box become the Active Window" ? It is whilst being displayed, but it closes on Keydown Enter. For my purposes it would be more convenient if it closed with Keyup, like it does if the user presses spacebar. To side track, I could have phrased my original question and subject better, namely: Detect if user closed msgbox with key Enter, if so prevent or early exit Key events in my controls (with focus) until user has released Enter. In case relevant my controls also have mouse events, but not Click events as these would also be activated with key Enter. Your suggestion looks promising but I'm not sure when and where to return and compare "ActiveWindowCaption" and presumably set a flag. Sorry to ask but if you think this will resolve my problem could you point me how to implement! Thanks, Paul -----Original Message----- Does the active message box become the Active Window" ? In this case you could check for the Caption using something based on this :- '== top ================================================ Declare Function GetActiveWindow Lib "user32" () As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal Hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long '======================== Sub GET_WINDOW_CAPTION() '======================== MsgBox (ActiveWindowCaption) End Sub '----------------------------------------- Function ActiveWindowCaption() As String '----------------------------------------- Dim strCaption As String Dim lngLen As Long '--------------------------------- strCaption = String$(255, vbNullChar) lngLen = Len(strCaption) If (GetWindowText(GetActiveWindow, strCaption, lngLen) 0) Then ActiveWindowCaption = strCaption End If End Function '== bottom ================================== --- Message posted from http://www.ExcelForum.com/ . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need to detect syntax in value | Excel Discussion (Misc queries) | |||
How to detect #N/A and return 0? | Excel Discussion (Misc queries) | |||
How to detect changes in a column? | Excel Discussion (Misc queries) | |||
detect worksheet | Excel Programming | |||
How to detect a col/row deletion? | Excel Programming |