Re: Change app.title at runtime?
- From: "Karl E. Peterson" <karl@xxxxxxxx>
- Date: Wed, 19 Jul 2006 11:55:15 -0700
Karl E. Peterson wrote:
JT wrote:
I have tested almost all possible properties and it's definitely the
title property. But it only changes in SQL current activity if i
change it at design time.(project properties)
Do I need some sort of PostMessage API or something to refresh it's
properties?
Ask yourself, "What Would SQL Do?" IOW, how do you presume this
value is being extracted? Until that can be answered, it's just wild
thrashing to suggest possible solutions.
Okay, here's the test that was necessary.
1) Brand new project,
2) Set title to unique string in Project Properties,
3) Compile and run,
4) Find it with Spy++
5) Note that our title (step 2) isn't a property of this window,
6) Note that our title *is* the Window Caption of window's owner!
Shazam!!! So, enough hints, or...? Aw, what the heck... Call
SetWindowText on the handle returned by FindHiddenTopWindow:
Private Declare Function GetWindowLong Lib "user32" Alias
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function EnumThreadWindows Lib "user32" (ByVal dwThreadId
As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(Destination As Any, Source As Any, ByVal Length As Long)
' Constants used with above APIs
Private Const GWL_HWNDPARENT As Long = (-8)
Public Function FindHiddenTopWindow() As Long
' This function returns the hidden toplevel window
' associated with the current thread of execution.
Call EnumThreadWindows(App.ThreadID, AddressOf EnumThreadWndProc,
VarPtr(FindHiddenTopWindow))
End Function
Private Function EnumThreadWndProc(ByVal hWnd As Long, ByVal lpResult As
Long) As Long
' Test to see if this window is parented.
' If not, it's the one we're looking for!
If GetWindowLong(hWnd, GWL_HWNDPARENT) Then
' Continue enumeration.
EnumThreadWndProc = True
Else
' Copy hWnd to result variable pointer,
' and stop enumeration.
Call CopyMemory(ByVal lpResult, hWnd, 4)
EnumThreadWndProc = False
End If
End Function
Hmmmmm, testing this entire notion, I note that setting App.Title does
indeed alter the caption of our hidden window! So, back to the beginning,
I'm stumped too. All I can guess at this point is that SQL isn't going to
notice the updated title, and just goes with whatever you start with?
<shrug>
Later... Karl
--
.
- References:
- Change app.title at runtime?
- From: JT
- Re: Change app.title at runtime?
- From: Karl E. Peterson
- Re: Change app.title at runtime?
- From: Tony Proctor
- Re: Change app.title at runtime?
- From: Randy Birch
- Re: Change app.title at runtime?
- From: JT
- Re: Change app.title at runtime?
- From: JT
- Re: Change app.title at runtime?
- From: Karl E. Peterson
- Change app.title at runtime?
- Prev by Date: Re: Change app.title at runtime?
- Next by Date: Re: Change app.title at runtime?
- Previous by thread: Re: Change app.title at runtime?
- Next by thread: Re: Change app.title at runtime?
- Index(es):
Relevant Pages
|