-
Oct 15th, 2020, 01:43 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Flashing a warning on the taskbar
I have developed a small program that times my work so that I am not sitting too long at the keyboard! After a preset time, a window flashes. However, even with with two screens my work sometimes obscures the warning window. I would therefore like to flash an icon on the task bar when triggered by the time I've preset.
There are lots of Google references to VB-Net. I do not want that, needless to say!
Thanks all !
-
Oct 15th, 2020, 01:56 PM
#2
Re: Flashing a warning on the taskbar
FlashWindow() or FlashWindowEx() in User32.dll?
-
Oct 15th, 2020, 02:04 PM
#3
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
Originally Posted by dilettante
FlashWindow() or FlashWindowEx() in User32.dll?
Thankyou for that very prompt answer. Could you be more explicit for this novice as to how to use that facility?
Thanks all !
-
Oct 15th, 2020, 06:52 PM
#4
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
I'm assuming with nothing further that I must research and try myself
This is what I cobbled together, with no success
Code:
Option Explicit
Private Sub Form_Load()
Private Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
End Sub
Private Sub Command1_Click()
Call FlashWindow(0, True) 'Hwnd is 0 for iconic, BInvert = true for flashing?
End Sub
Thanks all !
-
Oct 15th, 2020, 08:00 PM
#5
Re: Flashing a warning on the taskbar
FlashWindow function
Code:
Option Explicit
Private Const WIN32_FALSE As Long = 0
Private Const WIN32_TRUE As Long = 1
Private Declare Function FlashWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal bInvert As Long) As Long
'Click the Form to begin/end flashing:
Private Sub Form_Click()
With Timer1
.Enabled = Not .Enabled
If .Enabled Then
FlashWindow hWnd, WIN32_TRUE 'First flash.
Else
FlashWindow hWnd, WIN32_FALSE 'Reset to unflashed.
End If
End With
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
FlashWindow hWnd, WIN32_TRUE 'Subsequent flashes.
End Sub
-
Oct 15th, 2020, 08:05 PM
#6
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
Many thanks. Will that flash the icon on the taskbar?
Thanks all !
-
Oct 15th, 2020, 08:13 PM
#7
Re: Flashing a warning on the taskbar
When not minimized it tries to flash the window itself, and depending on the OS the taskbar icon may flicker or flash along with it. When minimized it should always flash.
-
Oct 15th, 2020, 11:21 PM
#8
Re: Flashing a warning on the taskbar
This is what I often use to signal attention.
It flashes as long until it gets clicked by the user.
(No timer needed as the FlashWindowEx has flags to let the OS time it)
Code:
Private Type FLASHWINFO
cbSize As Long
hWnd As Long
dwFlags As Long
uCount As Long
dwTimeout As Long
End Type
Private Declare Function FlashWindowEx Lib "user32" (ByRef pFWI As FLASHWINFO) As Long
Public Sub FlashForm(ByVal Form As VB.Form)
Const FLASHW_CAPTION As Long = &H1, FLASHW_TRAY As Long = &H2, FLASHW_TIMERNOFG As Long = &HC
Dim FWI As FLASHWINFO
With FWI
.cbSize = LenB(FWI)
.dwFlags = FLASHW_CAPTION Or FLASHW_TRAY Or FLASHW_TIMERNOFG
.hWnd = Form.hWnd
.dwTimeout = 0 ' Default cursor blink rate
.uCount = 0
End With
FlashWindowEx FWI
End Sub
-
Oct 16th, 2020, 12:06 AM
#9
Re: Flashing a warning on the taskbar
You could give this a wee try -
Make Your Form Cover the Whole Screen, Including Taskbar
https://www.freevbcode.com/ShowCode.asp?ID=469
Code:
Option Explicit
Private Declare Function GetSystemMetrics Lib _
"user32" (ByVal nIndex 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 SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Const HWND_TOP = 0
Private Const SWP_SHOWWINDOW = &H40
Public Function CoverWholeScreen(frm As Object) As Boolean
'Usage: pass the form object you want to cover whole
'screen to this object; e.g., CoverWholeScreen me
'Returns: True if successful, false otherwise
Dim lngXPos As Long
Dim lngYPos As Long
Dim lngRet As Long
On Error GoTo ErrorHandler
frm.WindowState = vbNormal
lngXPos = GetSystemMetrics(SM_CXSCREEN)
lngYPos = GetSystemMetrics(SM_CYSCREEN)
lngRet = SetWindowPos(frm.hwnd, HWND_TOP, 0, 0, _
lngXPos, lngYPos, SWP_SHOWWINDOW)
CoverWholeScreen = lngRet <> 0
ErrorHandler:
End Function
-
Oct 16th, 2020, 01:50 AM
#10
Fanatic Member
Re: Flashing a warning on the taskbar
Originally Posted by Krool
This is what I often use to signal attention.
It flashes as long until it gets clicked by the user.
(No timer needed as the FlashWindowEx has flags to let the OS time it)
Code:
Private Type FLASHWINFO
cbSize As Long
hWnd As Long
dwFlags As Long
uCount As Long
dwTimeout As Long
End Type
Private Declare Function FlashWindowEx Lib "user32" (ByRef pFWI As FLASHWINFO) As Long
Public Sub FlashForm(ByVal Form As VB.Form)
Const FLASHW_CAPTION As Long = &H1, FLASHW_TRAY As Long = &H2, FLASHW_TIMERNOFG As Long = &HC
Dim FWI As FLASHWINFO
With FWI
.cbSize = LenB(FWI)
.dwFlags = FLASHW_CAPTION Or FLASHW_TRAY Or FLASHW_TIMERNOFG
.hWnd = Form.hWnd
.dwTimeout = 0 ' Default cursor blink rate
.uCount = 0
End With
FlashWindowEx FWI
End Sub
in my system 7 can not flash until i click form2
Private Type FLASHWINFO
cbSize As Long
hWnd As Long
dwFlags As Long
uCount As Long
dwTimeout As Long
End Type
Private Declare Function FlashWindowEx Lib "user32" (ByRef pFWI As FLASHWINFO) As Long
Public Sub FlashForm(ByVal Form As VB.Form)
Const FLASHW_CAPTION As Long = &H1, FLASHW_TRAY As Long = &H2, FLASHW_TIMERNOFG As Long = &HC
Dim FWI As FLASHWINFO
With FWI
.cbSize = LenB(FWI)
.dwFlags = FLASHW_CAPTION Or FLASHW_TRAY Or FLASHW_TIMERNOFG
.hWnd = Form.hWnd
.dwTimeout = 0 ' Default cursor blink rate
.uCount = 0
End With
FlashWindowEx FWI
End Sub
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Command2_Click()
FlashForm Form2
End Sub
-
Oct 16th, 2020, 02:42 PM
#11
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
My alarm is geared to a countdown, which is the main purpose of my program. It works beautifully including flashing the screen when the count down is complete.
However, that does not solve my current problem. I specifically want the taskbar icon to flash (in concert with the form?) so that if my program's window is obscured by other work on the main screen, I see the taskbar icon flashing. Since this appears not to be guaranteed with the solutions so far, what about an alternative approach. What about a method of forcing the program window (form) to the top of other stuff on the screen?
Thanks all !
-
Oct 16th, 2020, 05:17 PM
#12
Hyperactive Member
Re: Flashing a warning on the taskbar
https://www.vbforums.com/showthread....n-taskbar-etc)
try this and with a timer change the icon.
or if you don't want to use ITaskbarList3, a timer and with some pictures change the icon
-
Oct 16th, 2020, 07:09 PM
#13
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
Interesting but as the post was in 2015 maybe it is for Vb.Net rather than Vb6? Also I am using the dratted W10!
Thanks all !
-
Oct 16th, 2020, 07:27 PM
#14
Re: Flashing a warning on the taskbar
Originally Posted by el84
What about a method of forcing the program window (form) to the top of other stuff on the screen?
Try this.
-
Oct 16th, 2020, 08:09 PM
#15
Re: Flashing a warning on the taskbar
The following quotes are from el84's post in the linked thread above.
Originally Posted by el84
If that is not a very long piece of code, can you post it please?
Here are the relevant parts from the demo linked above:
Code:
Option Explicit
Private Enum BOOL
FALSE_
TRUE_
End Enum
#If False Then
Dim FALSE_, TRUE_
#End If
Private Enum E_ShowWindow_CmdShow
SW_HIDE = 0 'Hides the window and activates another window.
SW_SHOWNORMAL = 1 'Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
SW_SHOWMINIMIZED = 2 'Activates the window and displays it as a minimized window.
SW_MAXIMIZE = 3 'Maximizes the specified window.
SW_SHOWMAXIMIZED = 3 'Activates the window and displays it as a maximized window.
SW_SHOWNOACTIVATE = 4 'Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated.
SW_SHOW = 5 'Activates the window and displays it in its current size and position.
SW_MINIMIZE = 6 'Minimizes the specified window and activates the next top-level window in the Z order.
SW_SHOWMINNOACTIVE = 7 'Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
SW_SHOWNA = 8 'Displays the window in its current size and position. This value is similar to SW_SHOW, except that the window is not activated.
SW_RESTORE = 9 'Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOWDEFAULT = 10 'Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_FORCEMINIMIZE = 11 'Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
End Enum
Private Declare Function AttachThreadInput Lib "user32.dll" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As BOOL) As BOOL
Private Declare Function BringWindowToTop Lib "user32.dll" (ByVal hWnd As Long) As BOOL
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Function GetShellWindow Lib "user32.dll" () As Long
Private Declare Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hWnd As Long, Optional ByRef lpdwProcessId As Long) As Long
Private Declare Function IsIconic Lib "user32.dll" (ByVal hWnd As Long) As BOOL
Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function SetFocusOn Lib "user32.dll" Alias "SetFocus" (Optional ByVal hWnd As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As Long) As BOOL
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As E_ShowWindow_CmdShow) As BOOL
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Declare Sub SwitchToThisWindow Lib "user32.dll" (ByVal hWnd As Long, Optional ByVal fAltTab As BOOL)
Private Function ForceForegroundWindow(ByVal hWnd As Long) As Boolean
Dim bAttached As Boolean, hWndFore As Long, App_ThreadID As Long, Fore_ThreadID As Long
hWndFore = GetForegroundWindow
If hWnd <> hWndFore Then
If optAPI(0) Then
ForceForegroundWindow = SetForegroundWindow(hWnd) <> FALSE_
If IsIconic(hWnd) Then ShowWindow hWnd, SW_RESTORE Else ShowWindow hWnd, SW_SHOW
Exit Function
End If
App_ThreadID = App.ThreadID
Fore_ThreadID = GetWindowThreadProcessId(hWndFore)
If App_ThreadID <> Fore_ThreadID Then
bAttached = AttachThreadInput(App_ThreadID, Fore_ThreadID, TRUE_) <> FALSE_: Debug.Assert bAttached
End If
Select Case True
Case optAPI(1): ForceForegroundWindow = SetForegroundWindow(hWnd) <> FALSE_
Case optAPI(2): ForceForegroundWindow = BringWindowToTop(hWnd) <> FALSE_
Case optAPI(3): ForceForegroundWindow = SetActiveWindow(hWnd) <> 0&
Case optAPI(4): ForceForegroundWindow = SetFocusOn(hWnd) <> 0&
Case optAPI(5): SwitchToThisWindow hWnd: ForceForegroundWindow = (GetForegroundWindow = hWnd)
Case optAPI(6): Select Case True
Case SetForegroundWindow(hWnd) <> FALSE_, _
BringWindowToTop(hWnd) <> FALSE_, _
SetActiveWindow(hWnd) <> 0&, _
SetFocusOn(hWnd) <> 0&
ForceForegroundWindow = True
Case Else 'Last resort
SwitchToThisWindow hWnd
ForceForegroundWindow = (GetForegroundWindow = hWnd)
End Select
End Select
If IsIconic(hWnd) Then ShowWindow hWnd, SW_RESTORE Else ShowWindow hWnd, SW_SHOW
If bAttached Then
bAttached = AttachThreadInput(App_ThreadID, Fore_ThreadID, FALSE_) <> FALSE_: Debug.Assert bAttached
End If
Else
ForceForegroundWindow = True
End If
End Function
Originally Posted by el84
Meanwhile, as I have said I have the main screen flashing and within the loop that does that I'd like to explore the idea of adding and removing a 'dummy' icon as a possible solution.
Can you please show the current code that you have?
Last edited by Victor Bravo VI; Oct 16th, 2020 at 08:16 PM.
-
Oct 17th, 2020, 12:15 AM
#16
Re: Flashing a warning on the taskbar
Here are 2 from PSC -
Title: Scrolling Sys Tray OCX
Description: This is a systray control with scrolling text on the tray.
Tray Progress Bar
A progress bar is a very temporary thing but still requires permanent space in a form. Wouldn't it be better to use a temporary space for it also? This project temporarily uses the system tray to display a customizable progress bar. Just include form fProgress and clsSystray with your project and set it's properties. A lil testform is included to show how it could be used. I know there are hundreds of progress bars in PSC, but this one is a little different - try it, download is 8.9 kB.
ROB's comment - It actually uses the full width of the Taskbar area, so Blind Freddy would easily see it
I just attempted to attach the 2 PSC files, and I am getting an error.
If you PM me your email address, I will send them to you
Rob
PS I also tried to insert images and got similar errors
Last edited by Bobbles; Oct 17th, 2020 at 12:19 AM.
-
Oct 17th, 2020, 12:48 AM
#17
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
Oh VB IV! Too much for my poor head. I will always just want to bring the timer form to the top. Could you just provide that code?
Thanks all !
-
Oct 17th, 2020, 01:40 AM
#18
Re: Flashing a warning on the taskbar
Originally Posted by el84
Could you just provide that code?
Code:
Option Explicit
Private Declare Function AttachThreadInput Lib "user32.dll" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Private Declare Function BringWindowToTop Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Function GetShellWindow Lib "user32.dll" () As Long
Private Declare Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hWnd As Long, Optional ByRef lpdwProcessId As Long) As Long
Private Declare Function IsIconic Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function SetFocusOn Lib "user32.dll" Alias "SetFocus" (Optional ByVal hWnd As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function SetWindowPos Lib "user32.dll" (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 uFlags As Long) As Long
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Sub SwitchToThisWindow Lib "user32.dll" (ByVal hWnd As Long, Optional ByVal fAltTab As Long)
Private Sub Timer1_Timer()
Const SW_SHOW = 5&, SW_RESTORE = 9&, HWND_NOTOPMOST = (-2&), HWND_TOPMOST = (-1&), SWP_NOSIZE = &H1&, SWP_NOMOVE = &H2&
Dim bAttached As Boolean, hWndFore As Long, App_ThreadID As Long, Fore_ThreadID As Long
hWndFore = GetForegroundWindow
If hWnd <> hWndFore Then
App_ThreadID = App.ThreadID
Fore_ThreadID = GetWindowThreadProcessId(hWndFore)
If App_ThreadID <> Fore_ThreadID Then
bAttached = AttachThreadInput(App_ThreadID, Fore_ThreadID, -True) <> False: Debug.Assert bAttached
End If
SetWindowPos hWnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE
SetForegroundWindow hWnd
BringWindowToTop hWnd
SetActiveWindow hWnd
SetFocusOn hWnd
SwitchToThisWindow hWnd
If IsIconic(hWnd) Then ShowWindow hWnd, SW_RESTORE _
Else ShowWindow hWnd, SW_SHOW
If bAttached Then
bAttached = AttachThreadInput(App_ThreadID, Fore_ThreadID, False) <> False: Debug.Assert bAttached
End If
End If
End Sub
-
Oct 17th, 2020, 03:27 PM
#19
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar
Victor Bravo VI: Thank you for that last selected code for bring forward. I made a couple of changes. Since the Functions for GetDeskTopWindow and GetShellWindow were not ever referenced, I removed them. Also I removed the two invocations of Debug Assert.
This does everything I wanted as it brings my existing flashing main window to the fore however many others obscure it, so I always get my flashing warning however much other stuff is on the screen. The taskbar icon is of no importance now! I am marking the thread resolved.
EDIT: Unexpected bonus. While my flashing screen is brought to the top, courtesy the API code kindly given, I have just discovered that any document I am working on in the on in the other screen (or the keyboard?) locks up, so further alerting me that action must be taken! In my case stopping the alarm with the appropriate command button.
Last edited by el84; Oct 18th, 2020 at 05:39 PM.
Thanks all !
-
Oct 19th, 2020, 03:45 PM
#20
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar REVISITED
I'd like to return to the topic. After resetting my timer I'd like to turn off the 'bring to front' effect as it persists. I suspect that I may need another declaration? Then I'll need some code similar to the code under the provisional sub 'Timer' but to take away the 'bring to front', in another subroutine say named 'Stop'. Could VB VI help here?
Thanks all !
-
Oct 19th, 2020, 06:39 PM
#21
Re: Flashing a warning on the taskbar REVISITED
Originally Posted by el84
... I have just discovered that any document I am working on in the on in the other screen (or the keyboard?) locks up, ...
I believe what's actually happening is that the (keyboard) focus is transferred to your alarm window, thus making it appear as if your document window is unresponsive.
Originally Posted by el84
Then I'll need some code similar to the code under the provisional sub 'Timer' but to take away the 'bring to front', in another subroutine say named 'Stop'.
Relinquishing (keyboard) focus is easier than (forcibly) taking it:
Code:
Private Sub SendToBack() '<-- Can't name this as "Stop" as that's a reserved word
Const HWND_BOTTOM = 1&, SWP_NOSIZE = &H1&, SWP_NOMOVE = &H2&, SWP_NOACTIVATE = &H10&
SetWindowPos hWnd, HWND_BOTTOM, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE
WindowState = vbMinimized '<-- Optional: Minimize the window if you want
End Sub
-
Oct 19th, 2020, 06:55 PM
#22
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar REVISITED
Thanks. This is the time to ask if you can recommend a good VB6 API book for for beginners!
Thanks all !
-
Oct 19th, 2020, 08:53 PM
#23
Re: Flashing a warning on the taskbar REVISITED
Originally Posted by el84
This is the time to ask if you can recommend a good VB6 API book for for beginners!
Well, you could begin with this chapter in the VB6 manual: Accessing DLLs and the Windows API.
After that, you might want to peruse these:
I haven't read any of those books in their entirety, so I couldn't tell you if they're really suitable for Windows API novices or not. Additionally, I learned API programming by reading their MSDN documentation, so I recommend doing it the same way — it's cheaper than buying a book!
-
Oct 19th, 2020, 10:30 PM
#24
Thread Starter
Frenzied Member
Re: Flashing a warning on the taskbar REVISITED
Originally Posted by Victor Bravo VI
Well, you could begin with this chapter in the VB6 manual: Accessing DLLs and the Windows API.
After that, you might want to peruse these:
I haven't read any of those books in their entirety, so I couldn't tell you if they're really suitable for Windows API novices or not. Additionally, I learned API programming by reading their MSDN documentation, so I recommend doing it the same way — it's cheaper than buying a book!
"The" manual?
Thanks all !
-
Oct 20th, 2020, 01:15 AM
#25
Re: Flashing a warning on the taskbar REVISITED
Originally Posted by el84
"The" manual?
Yes, as you would expect from a highly polished product, VB6 came with both a physical and electronic manual. In fact, Microsoft still hosts the electronic copy on their site to this day, as evidenced by my link above.
-
Oct 20th, 2020, 02:08 AM
#26
Re: Flashing a warning on the taskbar REVISITED
Originally Posted by Victor Bravo VI
In fact, Microsoft still hosts the electronic copy on their site to this day, as evidenced by my link above.
. . . with all internal links totally broken rendering docs next to unusable. Not suprising as most articles are last modified like in 1999.
cheers,
</wqw>
-
Oct 22nd, 2020, 04:12 AM
#27
Thread Starter
Frenzied Member
Re: [RESOLVED] Flashing a warning on the taskbar
I should add one thing to the thread. I found that if I kept trying to key in the current window on one screen while the alarm was flashing in the front of the other screen (which works well) keystrokes got captured by the alarm screen and triggered random events (from random command buttons) on my alarm form.
I only wanted to see the flashing alarm screen at the front, however many keystrokes I applied, there being button on that form to stop the alarm, so I solved that by cmdStopAlarm.SetFocus. Despite compiling without error, got runtime error 5 at first but realised I was issuing SetFocus before that cmd was visible or enabled. All working now.
Thanks all !
-
Oct 23rd, 2020, 01:39 AM
#28
Thread Starter
Frenzied Member
Re: [RESOLVED] Flashing a warning on the taskbar
Originally Posted by el84
I should add one thing to the thread. I found that if I kept trying to key in the current window on one screen while the alarm was flashing in the front of the other screen (which works well) keystrokes got captured by the alarm screen and triggered random events (from random command buttons) on my alarm form.
I only wanted to see the flashing alarm screen at the front, however many keystrokes I applied, there being button on that form to stop the alarm, so I solved that by cmdStopAlarm.SetFocus. Despite compiling without error, got runtime error 5 at first but realised I was issuing SetFocus before that cmd was visible or enabled. All working now.
Further change. The change above led to the alarm stopping flashing if I kept keying in another window. I fixed that by having another button that does nothing, and setting the focus on that. I made it tiny on the form, as it will never be used from there. If I tried to make visible = false of course I got error 5, though I did make it visible = false at start up and = true just before window to front routine.
Thanks all !
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
|