473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Salad...Thanx

Salad,
I never got round to using the code you supplied back in October but
have done today. It works just as I wanted and am really grateful.
Thanx again,

Mark
Mark wrote:
Hi All,
Does anyone know of a way that I can get a task bar button to flash if
a
form is open? I have created something like a messenger application within
my database but there are a few people who have it open but do not use it
exclusivley. If someone was to send them a message, it could be hours
before
they see it so if I could get the taskbar button to flash if the form
opens,
they can be alerted instantly.

Many thanks,

Mark


I went to Google and was referred to the following kb article at
http://support.microsoft.com...Q147815.

OK, this KB is referring to VB. Plus, it needed to be modified for the
taskbar, not the window. So if you want a quick demo of how I modified
it, do the following.

Create a form...Form1. Add a text field (Text0) and a command button
CommandExit.

Set the tab order to command button first, text0 last, since when you
put your mouse onto Text0 it will stop the blinking.

Now, drop the following code into the form1's module by cut/paste

'start cut
Option Compare Database
Option Explicit
Dim Success As Long
Dim lngHwnd As Long
Private Sub Form_Load()
'get the hwnd of Access
lngHwnd = fEnumWindows()
Me.TimerInterval = GetCaretBlinkTime()
End Sub
Private Sub CommandExit_Click()
DoCmd.Close
End Sub
Private Sub Form_Timer()
Success = FlashWindow(lngHwnd, 1)
End Sub
Private Sub Text0_GotFocus()
Me.TimerInterval = 0
End Sub
'end cut

What happens is that when the form loads, it will start blinking.
Minimize Access if you like...the taskbar for Access should be blinking.

Now when you maxmize Access and go to Text0, the blinking will stop.

In order to make this work, you need to get the hwnd of Access. So I
swiped the code at http://www.mvps.org/access/api/api0013.htm and
modified it slightly. First, I added the function calls for
GetCaretBlinkTime and FlashWindow and removed the calls to get the class
name. I do a search for the phrase "Microsoft Access". You may want to
change the search for something else. Anyway.........

Create a new code module and cut/paste the following code. Save the
module. Now save/close Form1. Now open it. Minimize it. It should be
blinking.
'start cut here
Option Compare Database
Option Explicit

Declare Function FlashWindow Lib "user32" ( _
ByVal Hwnd As Long, _
ByVal bInvert As Long) As Long

Declare Function GetCaretBlinkTime Lib "user32" () As Long

Private Declare Function apiGetDesktopWindow Lib "user32" Alias _
"GetDesktopWindow" () As Long
Private Declare Function apiGetWindow Lib "user32" Alias _
"GetWindow" (ByVal Hwnd As Long, _
ByVal wCmd As Long) As Long
Private Declare Function apiGetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal Hwnd As Long, ByVal _
nIndex As Long) As Long
Private Declare Function apiGetWindowText Lib "user32" Alias _
"GetWindowTextA" (ByVal Hwnd As Long, ByVal _
lpString As String, ByVal aint As Long) As Long
Private Const mcGWCHILD = 5
Private Const mcGWHWNDNEXT = 2
Private Const mcGWLSTYLE = (-16)
Private Const mcWSVISIBLE = &H10000000
Private Const mconMAXLEN = 255
Function fEnumWindows()
Dim lngx As Long, lngLen As Long
Dim lngStyle As Long, strCaption As String

lngx = apiGetDesktopWindow()

'Return the first child to Desktop
lngx = apiGetWindow(lngx, mcGWCHILD)

Do While Not lngx = 0
strCaption = fGetCaption(lngx)
If Len(strCaption) > 0 Then
lngStyle = apiGetWindowLong(lngx, mcGWLSTYLE)
'enum visible windows only
If lngStyle And mcWSVISIBLE Then

'CHANGE YOUR SEARCH STRING HERE. I USE MS ACCESS
'YOU CAN SEARCH FOR YOUR APP NAME TOO. THE DEBUG
'PRINT SHOULD HELP YOU OUT TO DETERMINE WHAT
'WINDOW TO SEARCH FOR,

If InStr(fGetCaption(lngx), "Microsoft Access") > 0 Then
fEnumWindows = lngx
Exit Do
End If
'Debug.Print lngx
'Debug.Print "Caption = " & fGetCaption(lngx)
'Debug.Print
End If
End If
lngx = apiGetWindow(lngx, mcGWHWNDNEXT)
Loop
End Function
Private Function fGetCaption(Hwnd As Long) As String
Dim strBuffer As String
Dim intCount As Integer

strBuffer = String$(mconMAXLEN - 1, 0)
intCount = apiGetWindowText(Hwnd, strBuffer, mconMAXLEN)
If intCount > 0 Then
fGetCaption = Left$(strBuffer, intCount)
End If
End Function
'end cut here

Nov 13 '05 #1
0 1194

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Catherine Jones | last post by:
Hi all we are getting active x component can not create object (Error No. 16) while creating an instance of File System Object in ASP client side script. Could you plz help us in solving this...
9
by: dave | last post by:
hi i have got one field in sql server 2000 database. field1 char 50 in one record, i m storing value -1 but it doesnt satisfy following condition if (rs("field1")) = cstr("-1") Then...
7
by: zjut | last post by:
I need to implement the method : round(String name, int index) The given string maybe the every type of float type, ( the msdn given the regax is that : integral-digits]exponential-digits]) ...
2
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I am new in asp.net, i encounter some problems in using drop down list and datagrid. I have manage to bind the data into datagrid but i wanted to bind the data into the datagrid accroding...
3
by: Justine | last post by:
Hi all, I have an application created using a .Net Framework 1.1, is it possible to run the same on Framework 1.0. if yes ... then any extran thing (Coding ) to be done ... ???? Pls help.... ...
4
by: Justin | last post by:
Hi, i need some help on this urgently... Thanx.... The situation is like this, i need to find out the way to convert Chinese characters into hexa code. but the problem is what i got from bin2hex()...
6
by: luanhoxung | last post by:
dear all!! i met the headache problem in setting value for some controls in my form. i have 2 combo box in form F1. i want to set value for some textbox in F1 when i choose value from 2 combo...
2
by: olcaygul | last post by:
hii i´m learning jsp and html with sql and i´m beginer on it, i have the table andcodes below in mysql and jsp, i´m working on html and jsp with netbeans IDE 3.6. of course if i try to insert any...
8
by: Kappucino XL | last post by:
Good Morning My Very Experienced Developers... I need to place checkboxes for every record in a combobox. I also need to generate a report for only those records CHECKED... I'm still a trainee...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.