|
-
November 6th, 1999, 08:36 PM
#1
How to put label's caption into taskbar
-
November 6th, 1999, 09:49 PM
#2
Re: How to put label's caption into taskbar
If you mean how can you make the Taskbar Caption different to the Forms Caption, try this Code Snippet I put together a while ago:
In a Module..
public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong as Long) as Long
private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination as Any, Source as Any, byval Length as Long)
private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (byval lpPrevWndFunc as Long, byval hwnd as Long, byval Msg as Long, byval wParam as Long, byval lParam as Long) as Long
public Const GWL_WNDPROC = (-4)
private Const WM_GETTEXT = &HD
public lPrevWnd as Long
public sFormCaption as string
public Function SubWindow(byval hwnd as Long, byval Msg as Long, byval wParam as Long, byval lParam as Long) as Long
If Msg = WM_GETTEXT then
'Substitute the Default Form Caption for our own Caption
CopyMemory byval lParam, byval sFormCaption, len(sFormCaption)
wParam = len(sFormCaption)
SubWindow = wParam
else
SubWindow = CallWindowProc(lPrevWnd, hwnd, Msg, wParam, byval lParam)
End If
End Function
In the Form..
private Sub Form_Load()
'The Taskbar Caption is set using the Normal Caption property
Caption = "TaskBar Caption"
'set the Forms Caption
sFormCaption = "Form Caption" & Chr(0)
'Subclass the Form
lPrevWnd = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubWindow)
End Sub
private Sub Form_Unload(Cancel as Integer)
'Release the Subclassing
Call SetWindowLong(hwnd, GWL_WNDPROC, lPrevWnd)
End Sub
Use the Caption Property of the Form to Set the TaskBar Caption, and the sFormCaption Variable to Set the Forms Caption.
Aaron Young
Analyst Programmer
[email protected]
[email protected]
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
|