|
-
Sep 23rd, 2006, 11:37 AM
#1
Thread Starter
New Member
How to draw on topmost windows
Hi to all vb programmers,
I am developing a solution for cybercafe. I have to display service time on bottom of any topmost windows like internet explorer,Microsoft word or any current 3D Game. I have got succeeded in displaying service time on topmost winodws by using getforegroundwindows, CreateDC,and DrawText. But Incase of 3D Applications, display of service time is flickered. Is there any way to draw text on topmost windows with clear display of text. Plz Help me
-
Sep 24th, 2006, 01:22 AM
#2
Junior Member
Re: How to draw on topmost windows
I'm using C++ and am interested in playing with this. How do you hook the system so you know when the Foreground Window has changed?
-
Sep 24th, 2006, 05:50 AM
#3
Thread Starter
New Member
Re: How to draw on topmost windows
 Originally Posted by Chazwazza
I'm using C++ and am interested in playing with this. How do you hook the system so you know when the Foreground Window has changed?
By using Getforegroundwindow API with timer control, i can track changes in foreground window.
-
Sep 24th, 2006, 06:50 AM
#4
Junior Member
Re: How to draw on topmost windows
I realise it can be done with a timer, but that is a bit resource intensive because in my case it would have to be called very frequently (every 10ms probably), just hoping there was some kind of hook I could use, but if I have to use a timer I will.
-
Sep 28th, 2006, 08:06 AM
#5
Thread Starter
New Member
Re: How to draw on topmost windows
 Originally Posted by Chazwazza
I realise it can be done with a timer, but that is a bit resource intensive because in my case it would have to be called very frequently (every 10ms probably), just hoping there was some kind of hook I could use, but if I have to use a timer I will.
So Anybody have any idea how to draw text on foreground window with clear display. Plz Reply me
-
Dec 17th, 2006, 11:36 AM
#6
Thread Starter
New Member
Re: How to draw on topmost windows
Please Help me if any vb expert is here???????????????
-
Dec 18th, 2006, 08:06 AM
#7
Re: How to draw on topmost windows
I'd need to see the code, but off the top of my head try, LockWindowUpdate API, before and after a change, ie Lock,... Update the time,... then unlock.
Here are some related API functions to use:
VB Code:
Public Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Public Declare Function apiLockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Integer) As Integer
Public Declare Function apiGetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Integer) As Integer
Public Declare Function apiGetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Integer) As Integer
Public Declare Function apiWindowFromDC Lib "user32" Alias "WindowFromDC" (ByVal hdc As Integer) As Integer 'Retrieves the handle of the window associated with a device context
Public Declare Function apiGetTopWindow Lib "user32" Alias "GetTopWindow" (ByVal hwnd As Integer) As Integer
VB Code:
apiLockWindowUpdate(apiFindWindow(vbNullString, "Form1"))
'Refresh time here
apiLockWindowUpdate(False)
'Where Form1 is the caption of the window your updating
'Or try GetDeskTopwindow, to lock the entire desktop for that split second
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
|